Giter Club home page Giter Club logo

naan_reg_public's Introduction

naan_reg_public

This is a public representation of the information contained in the private NAAN registry records.

The content is expressed in JSON and is generated using a python script executed by a GitHub action that retrieves the current copy of the main_naans file from the NAAN registry, parses the ANVL, and generates the JSON records as a single JSON document and also as a folder hierarchy of individual JSON records.

The artifacts are published using GitHub pages, accessible at:

https://cdluc3.github.io/naan_reg_public/

The conversion script

naan_reg_json provides a tool for converting NAAN registry ANVL to JSON. It includes JSON-schema with generated documentation for private and publicly visible NAAN records.

Usage

$python naan_reg_json.py --help
usage: naan_reg_json.py [-h] [-s] [-p] [path]

Generate JSON representation of naan_reg_priv/main_naans. This tool translates the 
NAAN registry file from ANVL to JSON to assist downstream programmatic use. If pydantic 
is installed then the script can output JSON schema describing the JSON respresentation 
of the transformed NAAN entries.

positional arguments:
  path          Path to naan_reg_priv ANVL file.

optional arguments:
  -h, --help    show this help message and exit
  -s, --schema  Generate JSON schema and exit.
  -p, --public  Output public content only.

For conversion from ANVL to JSON no additional dependencies are needed if using Python3.8 or later. E.g. (portions redacted):

$python naan_reg_json.py ../naan_reg_priv/main_naans

{
  "12025": {
    "what": "12025",
    "where": "http://www.nlm.nih.gov",
    "target": "http://www.nlm.nih.gov/$arkpid",
    "when": "2001-03-08T00:00:00+00:00",
    "who": {
      "name": "US National Library of Medicine",
      "acronym": null,
      "address": "8600 Rockville Pike, Bethesda, MD 20894, USA"
    },
    "na_policy": {
      "orgtype": "NP",
      "policy": "(:unkn) unknown",
      "tenure": "2001",
      "policy_url": null
    },
    "test_identifier": null,
    "service_provider": null,
    "purpose": "unspecified",
    "why": "ARK",
    "contact": {
      "name": "Marill, Jennifer",
      "unit": null,
      "tenure": null,
      "email": "[email protected]",
      "phone": "+1 301-435-7072"
    },
    "alternate_contact": null,
    "comments": null,
    "provider": null
  },
  ...

A public view of the ANVL to JSON can be generated using the -p or --public option:

$python naan_reg_json.py -p ../naan_reg_priv/main_naans

{
  "12025":{
    "what": "12025",
    "where": "http://www.nlm.nih.gov",
    "target": "http://www.nlm.nih.gov/$arkpid",
    "when": "2001-03-08T00:00:00+00:00",
    "who": {
        "name": "US National Library of Medicine",
        "acronym": null
    },
    "na_policy": {
        "orgtype": "NP",
        "policy": "(:unkn) unknown",
        "tenure": "2001",
        "policy_url": null
    },
    "test_identifier": null,
    "service_provider": null,
    "purpose": "unspecified"
    }
  },
  ...

For JSON-schema generation, pydantic is required:

pip install pydantic

The public view and full view have different schemas, they can be generated like:

$python naan_reg_json.py -s > schema/naan_schema.json

and

$python naan_reg_json.py -s -p > schema/public/naan_schema.json

Schema documentation can be generated if json-schema-for-humans is installed:

pip install json-schema-for-humans

To generate the schema documentation:

generate-schema-doc --config-file docs_config.yaml ./schema/naan_schema.json ./schema/
generate-schema-doc --config-file docs_config.yaml --config template_name=md ./schema/naan_schema.json ./schema/
generate-schema-doc --config-file docs_config.yaml ./schema/public/naan_schema.json ./schema/public/
generate-schema-doc --config-file docs_config.yaml --config template_name=md ./schema/public/naan_schema.json ./schema/public/

Acknowledgement

This work is supported by the California Digital Library.

naan_reg_public's People

Contributors

datadavev avatar mariagould avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.