Skip to content

Instantly share code, notes, and snippets.

@cthoyt
Created March 6, 2026 13:14
Show Gist options
  • Select an option

  • Save cthoyt/a11b51a8a186b1e3d6e47918f2a82165 to your computer and use it in GitHub Desktop.

Select an option

Save cthoyt/a11b51a8a186b1e3d6e47918f2a82165 to your computer and use it in GitHub Desktop.
Get example LUIDs for BARTOC records.
{
"14": [
"ffdd3a7e-f82e-4600-98b1-20402e74b0a6"
],
"15": [
"1837"
],
"16": [
"627"
],
"109": [
"1023371"
],
"181": [
"0001017"
],
"216": [
"0000001"
],
"241": [
"3",
"32",
"325",
"325.4",
"325.4-325.9"
],
"305": [
"2842"
],
"391": [
"C063233",
"D000001",
"Q000473"
],
"400": [
"98034"
],
"430": [
"117145750"
],
"445": [
"9861/3"
],
"447": [
"277.9",
"401",
"401-405",
"995.81",
"A01.1",
"C34",
"E950",
"G00",
"R25",
"R25-R29",
"R25.3",
"V15.01",
"V20",
"XVIII"
],
"449": [
"A10BA02"
],
"454": [
"nb2018006591"
],
"459": [
"11HH(ELISABETH)35",
"3",
"49E3932",
"98C",
"98C(...)(%2B1)",
"98C(ZENOBIA%20SEPTIMIA)2"
],
"507": [
"ICTV19990991"
],
"509": [
"2170610",
"subclass"
],
"528": [
"101775319"
],
"549": [
"26753"
],
"558": [
"138488"
],
"562": [
"09200010"
],
"571": [
"63189"
],
"572": [
"0032571"
],
"576": [
"0110974"
],
"581": [
"0004486"
],
"671": [
"1.1.1.1",
"2",
"2.-.-.-",
"2.3",
"2.3.-.-",
"2.3.1",
"2.3.1.-",
"2.3.1.n12",
"3.1.26.n2",
"3.4.24.B15"
],
"720": [
"146421"
],
"820": [
"0"
],
"822": [
"r3d100010772"
],
"1028": [
"0007807"
],
"1143": [
"0002502"
],
"1237": [
"10015919"
],
"1884": [
"08306",
"11214",
"A00494",
"AT07327",
"B00737",
"BT07002",
"C00778",
"CT07136",
"G02681"
],
"1895": [
"%",
"/A/s3/cg3/T3",
"/g",
"/m3",
"Cel.d-1",
"Em.s-2",
"K2",
"Wb",
"aBq",
"dL/g",
"dlm",
"dlx",
"g.cm-3",
"kW/h",
"m.s-2",
"m/s",
"m/s/d",
"mmol.mL-1",
"mol.L-1",
"mol.um",
"ng-1",
"pA",
"ug.mL-1",
"umol.L-1",
"us"
],
"1897": [
"LL379-9"
],
"1899": [
"0003fc3f-1522-4fca-bf3f-bcef0dcec405"
],
"1915": [
"4QHKG"
],
"1937": [
"0011140"
],
"1940": [
"L704278",
"P675",
"Q47475003"
],
"2021": [
"0000-0003-4423-4370"
],
"2022": [
"aaf",
"ar-SA",
"en",
"en-GB"
],
"2053": [
"75121530"
],
"2054": [
"241"
],
"17791": [
"589462"
],
"17815": [
"Access"
],
"17818": [
"Asset"
],
"17844": [
"authorList"
],
"17875": [
"Content"
],
"18206": [
"baseDimensionEnumeration"
],
"18250": [
"Person"
],
"18274": [
"prefLabel"
],
"18311": [
"DateTimeDescription"
],
"18355": [
"0000041"
],
"18377": [
"DB14938"
],
"18951": [
"bioregistry"
],
"20052": [
"C2584994"
],
"20288": [
"111",
"ErdeUndKosmos"
],
"20299": [
"1000001"
],
"20394": [
"ceaf4ca0-9b09-4313-85a5-2edf1762e443"
],
"20402": [
"Method"
],
"20428": [
"LexicalMatching"
],
"20430": [
"AC00963334"
],
"20434": [
"0807.4956v1"
],
"20461": [
"0000003"
],
"20464": [
"000000012281955X"
],
"20466": [
"0000079"
],
"20474": [
"03yrm5c26"
],
"20501": [
"0000123"
],
"20510": [
"realmGeol/GeologicFeature"
],
"20514": [
"CC-BY-1.0",
"GPL-1.0+"
],
"20684": [
"03733596-c643-4c14-a7bc-3048591a3f2d"
],
"20686": [
"284196006"
],
"20688": [
"16793"
],
"20689": [
"RID1"
],
"20697": [
"0005452"
],
"20698": [
"478",
"C023"
],
"20699": [
"0000001"
],
"20701": [
"000064"
],
"20702": [
"000410"
],
"20703": [
"0002902"
],
"20705": [
"03212fd7_abfd_4828_9c8e_62c293052d4b"
],
"20710": [
"application_case"
],
"20712": [
"0000253"
],
"20713": [
"0000485"
],
"20715": [
"/53355/cl010066723"
],
"20716": [
"10.1016/j.foodchem.2008.11.065",
"10.1038/s41597-022-01807-3",
"10.1093/acprof:oso/9780195159561.001.1",
"10.1139/z02-135",
"10.1333/s00897980202a",
"10.21/FQSQT4T3"
],
"20719": [
"AU124"
],
"20825": [
"belongsToCluster"
],
"20826": [
"00030015"
],
"20833": [
"002368"
],
"21017": [
"T039"
]
}
"""Get example LUIDs for each BARTOC record."""
import bioregistry
from collections import defaultdict
import json
def main() -> None:
rv: dict[str, set[str]] = defaultdict(set)
for resource in bioregistry.resources():
bartoc = resource.get_mapped_prefix("bartoc")
if not bartoc:
continue
bartoc = int(bartoc)
example = resource.get_example()
if not example:
continue
rv[bartoc].add(example)
rv[bartoc].update(resource.example_extras or [])
rv = {k: sorted(v) for k, v in rv.items()}
print(json.dumps(rv, indent=2, sort_keys=True))
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment