diff --git a/src/bioregistry/app/templates/resource.html b/src/bioregistry/app/templates/resource.html index 92a230e22..cf6b292ce 100644 --- a/src/bioregistry/app/templates/resource.html +++ b/src/bioregistry/app/templates/resource.html @@ -58,6 +58,9 @@
Registry {{ name }} + + + {{ utils.render_resource_warnings(resource) }}
diff --git a/src/bioregistry/app/ui.py b/src/bioregistry/app/ui.py index d5dbc5865..f2078edde 100644 --- a/src/bioregistry/app/ui.py +++ b/src/bioregistry/app/ui.py @@ -121,13 +121,19 @@ def resource(prefix: str): example_curie_extras = [ _resource.get_curie(example_extra, use_preferred=True) for example_extra in example_extras ] + name, name_source_metaprefix = _resource.get_name(provenance=True) + name_source_name = manager.get_registry(name_source_metaprefix).name + name_source_license = manager.get_registry(name_source_metaprefix).license return render_template( "resource.html", zip=zip, prefix=prefix, resource=_resource, bioschemas=json.dumps(_resource.get_bioschemas_jsonld(), ensure_ascii=False), - name=manager.get_name(prefix), + name=name, + name_source_metaprefix=name_source_metaprefix, + name_source_name=name_source_name, + name_source_license=name_source_license, example=example, example_extras=example_extras, example_curie=example_curie, diff --git a/src/bioregistry/schema/struct.py b/src/bioregistry/schema/struct.py index d58e42a0d..cc5866042 100644 --- a/src/bioregistry/schema/struct.py +++ b/src/bioregistry/schema/struct.py @@ -665,10 +665,12 @@ def get_mapped_prefix(self, metaprefix: str) -> Optional[str]: return None return self.get_mappings().get(metaprefix) - def get_prefix_key(self, key: str, metaprefixes: Union[str, Sequence[str]]): + def get_prefix_key(self, key: str, metaprefixes: Union[str, Sequence[str]], *, provenance: bool = False): """Get a key enriched by the given external resources' data.""" rv = self.dict().get(key) if rv is not None: + if provenance: + return rv, "bioregistry" return rv if isinstance(metaprefixes, str): metaprefixes = [metaprefixes] @@ -678,7 +680,11 @@ def get_prefix_key(self, key: str, metaprefixes: Union[str, Sequence[str]]): raise TypeError rv = external.get(key) if rv is not None: + if provenance: + return rv, metaprefix return rv + if provenance: + return None, None return None def get_default_uri(self, identifier: str) -> Optional[str]: @@ -832,8 +838,8 @@ def get_mappings(self) -> Dict[str, str]: """Get the mappings to external registries, if available.""" return self.mappings or {} - def get_name(self) -> Optional[str]: - """Get the name for the given prefix, it it's available.""" + def get_name(self, *, provenance: bool = False) -> Optional[str]: + """Get the name for the given prefix, if it's available.""" return self.get_prefix_key( "name", ( @@ -856,6 +862,7 @@ def get_name(self) -> Optional[str]: "bartoc", "lov", ), + provenance=provenance ) def get_description(self, use_markdown: bool = False) -> Optional[str]: