{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# 研究用のフォルダ構成を初期化する\n", "\n", "これはDMP情報に基づき、研究用のフォルダ構成を初期化するためのノートブックです。 \n", "※このノートブックを実行するためには、FLOWの「0. データガバナンス機能と連携する」の実行後である必要があります。" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 1. DMP情報からプロジェクト名を取得する" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ " - ## データガバナンス機能にDMP情報がある場合は以下を実行して2. に進む" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import sys\n", "import os\n", "\n", "sys.path.append(os.path.abspath(\"../util\"))\n", "\n", "import load\n", "\n", "dmp = load.get_dmp()\n", "project_name = dmp['project']['title']" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "- ## システム外にDMP情報がある場合は以下を実行して2. に進む" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "以下のセルを実行して、フォームにjson形式のDMPファイルのパスを入力してください。" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "DMP_PATH = input()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import sys\n", "import os\n", "\n", "sys.path.append(os.path.abspath(\"../util\"))\n", "\n", "import load\n", "\n", "dmp = load.get_dmp_from_outsystem(DMP_PATH)\n", "project_name = dmp['project']['title']" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 2. 取得したプロジェクト名で研究用のフォルダ構成を初期化する" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import os\n", "\n", "experiment_folder_pass = \"/home/jovyan/\" + project_name\n", "os.makedirs(experiment_folder_pass)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 3. 変更内容を書き戻す\n", "\n", "params.yamlの情報を用いてこのノートブックの実行結果をginリポジトリに反映します。" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import papermill as pm\n", "\n", "pm.execute_notebook(\n", " '../util/datalad_save_push.ipynb',\n", " '-',\n", " parameters = dict(SAVE_MESSAGE = '研究用のフォルダ構成を初期化', PATH = experiment_folder_pass)\n", ")" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.8" } }, "nbformat": 4, "nbformat_minor": 4 }