<jupyter_start><jupyter_text>PyRAT subject ingestion  Setup Using local config file (see [01_pipeline](./01_pipeline.ipynb))<jupyter_code>import os
# change to the upper level folder to detect dj_local_conf.json
if os.path.basename(os.getcwd())=='notebooks': os.chdir('..')
assert os.path.basename(os.getcwd())=='adamacs', ("Please move to the main directory")
from adamacs.pipeline import subject<jupyter_output>Connecting <EMAIL>:3306<jupyter_text>Manual entry<jupyter_code># Manual Entry
import datajoint as dj; import getpass
dj.config['database.host'] = '172.26.128.53'        # Put the server name between these apostrophe
dj.config['database.user'] = 'danielmk'             # Put your user name between these apostrophe
dj.config['database.password'] = <PASSWORD>(prompt='Database password:')
dj.config['custom']['pyrat_client_token'] = getpass.getpass(prompt="Pyrat client token:")
dj.config['custom']['pyrat_user_token'] = getpass.getpass(prompt="Pyrat user token:")
dj.conn()<jupyter_output><empty_output><jupyter_text>Initial check of tables<jupyter_code># subject.User.delete(); subject.Protocol.delete()
# subject.Line.delete(); subject.Subject.delete()
print('User', len(subject.User()))
print('Protocol', len(subject.Protocol()))
print('Line', len(subject.Line()))
print('Mutation', len(subject.Mutation()))
print('Subject', len(subject.Subject()))
print('SubjectGenotype', len(subject.SubjectGenotype()))<jupyter_output>User 0
Protocol 0
Line 0
Mutation 0
Subject 0
SubjectGenotype 0<jupyter_text>Automated ingestion<jupyter_code>from adamacs.ingest.pyrat import PyratIngestion<jupyter_output><empty_output><jupyter_text>This function permits wildcards when querying [the API](https://pyrat.uniklinik-bonn.de/pyrat-test/api/v2/specification/ui/Listing/get_animals).The function is designed to list all proposed insertions and ask for a confirmation before entered into the schema.<jupyter_code>PyratIngestion().ingest_animal("HSC-01*")
print('User', len(subject.User()))
print('Protocol', len(subject.Protocol()))
print('Line', len(subject.Line()))
print('Mutation', len(subject.Mutation()))
print('Subject', len(subject.Subject()))
print('SubjectGenotype', len(subject.SubjectGenotype()))
PyratIngestion().ingest_animal("HSC-02*")<jupyter_output><empty_output><jupyter_text>Confirm entry<jupyter_code>print('User', len(subject.User()))
print('Protocol', len(subject.Protocol()))
print('Line', len(subject.Line()))
print('Mutation', len(subject.Mutation()))
print('Subject', len(subject.Subject()))
print('SubjectGenotype', len(subject.SubjectGenotype()))<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1587850826605152, 'fraction_numerical': 0.01114955786236063, 'mean_word_length': 8.893536121673003, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 25, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 1, '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': '651548', 'license': 'MIT', 'n_tokens_mistral': 874, 'n_tokens_neox': 830, 'n_words': 159, 'path': 'notebooks/03_pyrat_insert.ipynb', 'repo_name': 'vathes/adamacs', 'size': '2624'}