---
title: eCTDv4のXMLメッセージのDocument要素部分の作成v
tags:  #[第9回大阪sas勉強会]  
author: [森岡裕[SASユーザー総会世話人]](https://www.docswell.com/user/6484025)
site: [Docswell](https://www.docswell.com/)
thumbnail: https://bcdn.docswell.com/page/LE3RP9DD75.jpg?width=480
description: [第9回大阪SAS勉強会] 関根 暁史
published: March 26, 24
canonical: https://www.docswell.com/s/6484025/K38112-2024-03-26-065011
---
# Page. 1

![Page Image](https://bcdn.docswell.com/page/LE3RP9DD75.jpg)

大阪
SAS勉強会
2024
eCTDv4のXMLメッセージの
Document要素部分の作成
関根 暁史
（藤本製薬株式会社）
The document element is used for the purposes
of transmitting the information about each
document related to an application.
Satoshi Sekine
Fujimoto Pharmaceutical Corp.


# Page. 2

![Page Image](https://bcdn.docswell.com/page/8EDYLGP2EG.jpg)

大阪
SAS勉強会
2024
UUID（汎用一意識別子）
➢ eCTD v4では、提出される様々な情報がそれぞれ一意のID (＝UUID) をもっており、
それらがデータベースに登録されマスタ化される
「eCTD v4.0運用開始に伴う情報提供(PMDA)より」
➢ UUIDは、8-4-4-4-12形式の文字列（32桁の英数字と4つのハイフンを含むテキスト
値）で記述した16進数のテキストである。UUIDは、ISO/IEC 11578:1996およびITUT Rec X.667 | ISO/IEC 9834-8:2005によって正式に定義されている。UUIDの表
記を以下に示す：
• ハイフンで区切られた一連の文字列：25635f23-a3a4-4ce0-9994-99c5f074960
「ICH IG 4.5.2章」
➢ UUIDにはバージョン1～5まである。
「Wikipediaより」
2


# Page. 3

![Page Image](https://bcdn.docswell.com/page/V7P623NLJ8.jpg)

大阪
SAS勉強会
2024
「Q&amp;A v1.6」より
＃
質問
回答
7
UUIDのバージョンについて、
ICHバリデーションルールはある
か？
ICH実装ガイドはバリデーションルールを
含んでおり、UUIDの衝突は却下の対象と
なる。ICH地域において、UUIDのバージョ
ンはチェックされていない。
本発表では、ファイル
名から取得できる
UUIDバージョン５を採
用するものとする。
3


# Page. 4

![Page Image](https://bcdn.docswell.com/page/2JV3D4K6EQ.jpg)

大阪
SAS勉強会
2024
構成管理表の準備
Current
C:\20240322001\1
C:\20240322001\1
C:\20240322001\1
C:\20240322001\1
Title
ADSL
define.xml
define2-0-0.xsl
ADRG
Href
m5/datasets/study
m5/datasets/study
m5/datasets/study
m5/datasets/study
id/analysis/adam/datasets/adsl.
id/analysis/adam/datasets/defin
id/analysis/adam/datasets/defin
id/analysis/adam/datasets/adrg
「Structure1.xlsx」
この情報をSASで読み込ん
でXMLを作成する。
UUIDを生成する関数は
SASにはないので、Python
の力を借りる。
4


# Page. 5

![Page Image](https://bcdn.docswell.com/page/5EG3Y1Q27L.jpg)

大阪
SAS勉強会
2024
UUIDの発生
このファイル名を元にUUID
を発生させる。
20240322001/1/m5/datasets/study id/analysis/adam/datasets/adsl.xpt
eCTD受付番号
提出連続番号
5


# Page. 6

![Page Image](https://bcdn.docswell.com/page/4JQ5MDK97P.jpg)

大阪
SAS勉強会
2024
UUIDの発生プログラム
このファイル名を元にUUID
proc fcmp outlib=work.fcmp2.pyfuncs;
を発生させる。
function MyFunc2(arg0 $) $200;
length Result $200;
declare object py(python);
submit into py;
def PyProduct(infile):
&quot;&quot;&quot;Output: MyKey&quot;&quot;&quot;
import uuid
id=str(uuid.uuid5(uuid.NAMESPACE_DNS,infile))
return id
endsubmit;
rc=py.publish();
rc=py.call(&#039;PyProduct&#039;,arg0);
Result=py.results[&#039;MyKey&#039;];
return(Result);
endfunc;
run;
6


# Page. 7

![Page Image](https://bcdn.docswell.com/page/K749VZKRE1.jpg)

大阪
SAS勉強会
2024
別途チェックサムを獲得
C:/20240322001/1/m5/datasets/study id/analysis/adam/datasets/adsl.xpt
実在のファイルからチェック
サム値を獲得してくる。
7


# Page. 8

![Page Image](https://bcdn.docswell.com/page/LJ1K3RXV7G.jpg)

大阪
SAS勉強会
2024
Document要素のイメージ（submissionunit.xml）
&lt;component&gt;
&lt;document&gt;
UUID
&lt;id root=&quot;18f98b3a-ac10-5076-8f45-ae4e9af376df&quot;&gt;
&lt;title value=&quot;ADSL&quot;&gt;
ハイパーリンク
&lt;text integrityCheckAlgorithm=&quot;SHA256&quot;&gt;
&lt;reference value=&quot;m5/datasets/study id/analysis/adam/datasets/adsl.xpt&quot;&gt;
&lt;integrityCheck&gt;0fa3b0b9634e7b97bb76ad5db3c5684056eecb5ec4d1964d8e8d5a1
d0e0735ee&lt;/integrityCheck&gt;
&lt;/text&gt;
チェッ クサム
&lt;/documet&gt;
&lt;/component&gt;
8


# Page. 9

![Page Image](https://bcdn.docswell.com/page/GJWDP1N372.jpg)

大阪
SAS勉強会
2024
プログラム（1/4）
/* 構成管理表があるフォルダー指定 */
%let _inpath=.;
proc delete data=_all_; run;
/* エクセルシートの読み込み */
proc import out=doc
datafile=&quot;&amp;_inpath.\Structure1.xlsx&quot;
dbms=EXCELcs replace;
sheet=&quot;Leaf&quot;;
scantext=yes;
usedate=yes;
scantime=yes;
run;
data sha;
set doc;
length sha $1000;
current=tranwrd(current,&quot;\&quot;,&quot;/&quot;);
sha=strip(current)||&quot;/&quot;||strip(href);
rev1=kreverse(scan(kreverse(current),1,&quot;/&quot;));
rev2=kreverse(scan(kreverse(current),2,&quot;/&quot;));
rev=strip(rev2)||&quot;/&quot;||strip(rev1)||&quot;/&quot;||strip(href);
call symputx(&quot;current&quot;,current);
run;
構成管理表
（Structure1.xlsx）から
情報を読み込む。
9


# Page. 10

![Page Image](https://bcdn.docswell.com/page/4EZGKP3GJ3.jpg)

大阪
SAS勉強会
2024
プログラム（2/4）
proc fcmp outlib=work.fcmp1.pyfuncs;
function MyFunc1(arg0 $) $200;
length Result $200;
declare object py(python);
submit into py;
def PyProduct(infile):
&quot;&quot;&quot;Output: MyKey&quot;&quot;&quot;
import hashlib
with open(infile,&#039;rb&#039;) as f:
id=hashlib.sha256(f.read()).hexdigest()
return id
endsubmit;
rc=py.publish();
rc=py.call(&#039;PyProduct&#039;,arg0);
Result=py.results[&#039;MyKey&#039;];
return(Result);
endfunc;
run;
SHA256アルゴリズムで
チェックサム値を獲得。
10


# Page. 11

![Page Image](https://bcdn.docswell.com/page/Y76YQMXQEV.jpg)

大阪
SAS勉強会
2024
プログラム（3/4）
proc fcmp outlib=work.fcmp2.pyfuncs;
function MyFunc2(arg0 $) $200;
length Result $200;
declare object py(python);
submit into py;
def PyProduct(infile):
&quot;&quot;&quot;Output: MyKey&quot;&quot;&quot;
import uuid
id=str(uuid.uuid5(uuid.NAMESPACE_DNS,infile))
return id
endsubmit;
rc=py.publish();
rc=py.call(&#039;PyProduct&#039;,arg0);
Result=py.results[&#039;MyKey&#039;];
return(Result);
endfunc;
run;
options cmplib=work.fcmp1;
data checksum;
set sha;
checksum=MyFunc1(unicodec(sha,&#039;utf8&#039;));
run;
options cmplib=work.fcmp2;
data uuid;
set checksum;
uuid=MyFunc2(unicodec(rev,&#039;utf8&#039;));
run;
UUIDバージョン5の発生。
11


# Page. 12

![Page Image](https://bcdn.docswell.com/page/G75GRZX274.jpg)

大阪
SAS勉強会
2024
プログラム（4/4）
data leaf;
set uuid;
Document要素の作成。
length text $1000;
text=&#039;&lt;component&gt;&#039;;output;
text=&#039;
&lt;document&gt;&#039;;output;
text=&#039;
&lt;id root=&quot;&#039;||strip(uuid)||&#039;&quot;&gt;&#039;;output;
text=&#039;
&lt;title value=&quot;&#039;||strip(title)||&#039;&quot;&gt;&#039;;output;
text=&#039;
&lt;text integrityCheckAlgorithm=&quot;SHA256&quot;&gt;&#039;;output;
text=&#039;
&lt;reference value=&quot;&#039;||strip(href)||&#039;&quot;&gt;&#039;;output;
text=&#039;
&lt;integrityCheck&gt;&#039;||strip(checksum)||&#039;&lt;/integrityCheck&gt;&#039;;output;
text=&#039;
&lt;/text&gt;&#039;;output;
text=&#039;
&lt;/documet&gt;&#039;;output;
text=&#039;&lt;/component&gt;&#039;;output;
run;
/* XMLメッセージ作成 */
filename def &quot;&amp;current.\submissionunit.xml&quot; encoding=&quot;utf8&quot; nobom;
data _null_;
set leaf;
if text^=&quot;&quot;;
file def;
put +(kverify(text,&quot; &quot;)-1 ) text;
XMLファイル出力。
run;
12


# Page. 13

![Page Image](https://bcdn.docswell.com/page/9J2YDRX1JR.jpg)

大阪
SAS勉強会
2024
ご清聴有難うございました
13


