<jupyter_start><jupyter_text>This notebook demonstrates how BioThings Explorer is able to transform any JSON response from API into biolink-compatible JSON structure using the built-in **JSON Transform** module.Below list two examples:1. Transformation of output from DISEASES API.2. Transformation of output from Stanford BioSample API.   Use Case 1: DISEASES API  Step 1: Fetch API response from DISEASES API<jupyter_code>import requests
json_doc = requests.get('http://pending.biothings.io/diseases/disease/MONDO:0019280').json()
json_doc<jupyter_output><empty_output><jupyter_text>Step 2: Fetch BTE response mapping file using BTE client<jupyter_code>from biothings_explorer.registry import Registry
reg = Registry()
mapping = reg.registry['DISEASES']['mapping']
mapping<jupyter_output><empty_output><jupyter_text>Step 3: Transform the output from DISEASES API to Biolink model<jupyter_code>from biothings_explorer.json_transformer import Transformer
tf = Transformer(json_doc, mapping)
tf.transform()<jupyter_output><empty_output><jupyter_text>Use Case 2: Stanford Biosample API  Step 1: Fetch API response from Stanford Biosample API<jupyter_code>import requests
json_doc = requests.get('http://api.kp.metadatacenter.org/biosample/search?q=biolink:Disease=MONDO:0007915&limit=10').json()
json_doc<jupyter_output><empty_output><jupyter_text>Step 2: Fetch BTE response mapping file using BTE client<jupyter_code>from biothings_explorer.registry import Registry
reg = Registry()
mapping = reg.registry['stanford_biosample_disease2sample']['mapping']
mapping<jupyter_output><empty_output><jupyter_text>Step 3: Transform the output from Stanford Biosample API to Biolink model<jupyter_code>from biothings_explorer.json_transformer import Transformer
tf = Transformer(json_doc=json_doc, mapping=mapping)
tf.transform()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.0854978354978355, 'fraction_numerical': 0.01461038961038961, 'mean_word_length': 8.73157894736842, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '367176', 'license': 'Apache-2.0', 'n_tokens_mistral': 616, 'n_tokens_neox': 578, 'n_words': 145, 'path': 'jupyter notebooks/Demo of JSON Transform.ipynb', 'repo_name': 'zhoue7673/biothings_explorer', 'size': '1848'}