jpomop 0.0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- jpomop-0.0.1/.github/workflows/ci.yml +21 -0
- jpomop-0.0.1/.gitignore +17 -0
- jpomop-0.0.1/LICENSE +202 -0
- jpomop-0.0.1/LICENSE-DATA +6 -0
- jpomop-0.0.1/PKG-INFO +121 -0
- jpomop-0.0.1/PROVENANCE.md +32 -0
- jpomop-0.0.1/README.md +97 -0
- jpomop-0.0.1/docs/adr/0000-template.md +10 -0
- jpomop-0.0.1/examples/walkthrough_en.ipynb +3867 -0
- jpomop-0.0.1/examples/walkthrough_ja.ipynb +3872 -0
- jpomop-0.0.1/pyproject.toml +45 -0
- jpomop-0.0.1/src/jpomop/__init__.py +3 -0
- jpomop-0.0.1/src/jpomop/cli.py +184 -0
- jpomop-0.0.1/src/jpomop/etl/__init__.py +130 -0
- jpomop-0.0.1/src/jpomop/etl/build.py +232 -0
- jpomop-0.0.1/src/jpomop/etl/checks.py +63 -0
- jpomop-0.0.1/src/jpomop/etl/clinical.py +148 -0
- jpomop-0.0.1/src/jpomop/etl/concepts.py +25 -0
- jpomop-0.0.1/src/jpomop/etl/schema.py +169 -0
- jpomop-0.0.1/src/jpomop/parse/__init__.py +17 -0
- jpomop-0.0.1/src/jpomop/parse/cross.py +77 -0
- jpomop-0.0.1/src/jpomop/parse/ef.py +81 -0
- jpomop-0.0.1/src/jpomop/parse/encoding.py +28 -0
- jpomop-0.0.1/src/jpomop/parse/fields.py +78 -0
- jpomop-0.0.1/src/jpomop/parse/result.py +37 -0
- jpomop-0.0.1/src/jpomop/parse/yoshiki1.py +291 -0
- jpomop-0.0.1/src/jpomop/report/__init__.py +62 -0
- jpomop-0.0.1/src/jpomop/spec/__init__.py +100 -0
- jpomop-0.0.1/src/jpomop/spec/codes/ef_data_kubun.yaml +25 -0
- jpomop-0.0.1/src/jpomop/spec/codes/ef_in_out.yaml +2 -0
- jpomop-0.0.1/src/jpomop/spec/codes/ef_yen_point.yaml +2 -0
- jpomop-0.0.1/src/jpomop/spec/codes/y1_admission_route.yaml +8 -0
- jpomop-0.0.1/src/jpomop/spec/codes/y1_death_24h.yaml +5 -0
- jpomop-0.0.1/src/jpomop/spec/codes/y1_discharge_outcome.yaml +10 -0
- jpomop-0.0.1/src/jpomop/spec/codes/y1_discharge_to.yaml +14 -0
- jpomop-0.0.1/src/jpomop/spec/codes/y1_sex.yaml +2 -0
- jpomop-0.0.1/src/jpomop/spec/dpc_ef.yaml +50 -0
- jpomop-0.0.1/src/jpomop/spec/dpc_yoshiki1.yaml +93 -0
- jpomop-0.0.1/src/jpomop/synth/__init__.py +210 -0
- jpomop-0.0.1/src/jpomop/vocab/__init__.py +184 -0
- jpomop-0.0.1/tests/helpers.py +128 -0
- jpomop-0.0.1/tests/test_cli.py +102 -0
- jpomop-0.0.1/tests/test_etl.py +216 -0
- jpomop-0.0.1/tests/test_manual_examples.py +217 -0
- jpomop-0.0.1/tests/test_parse.py +146 -0
- jpomop-0.0.1/tests/test_spec.py +56 -0
- jpomop-0.0.1/tests/test_vocab.py +47 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
name: ci
|
|
2
|
+
on:
|
|
3
|
+
push:
|
|
4
|
+
branches: [main]
|
|
5
|
+
pull_request:
|
|
6
|
+
jobs:
|
|
7
|
+
test:
|
|
8
|
+
strategy:
|
|
9
|
+
fail-fast: false
|
|
10
|
+
matrix:
|
|
11
|
+
python: ["3.12", "3.13"]
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@v4
|
|
15
|
+
- uses: astral-sh/setup-uv@v6
|
|
16
|
+
- run: uv venv --python ${{ matrix.python }}
|
|
17
|
+
- run: uv pip install -e ".[dev]"
|
|
18
|
+
- run: uv run --no-sync ruff check src tests
|
|
19
|
+
- run: uv run --no-sync ruff format --check src tests
|
|
20
|
+
- run: uv run --no-sync mypy src
|
|
21
|
+
- run: uv run --no-sync pytest -q
|
jpomop-0.0.1/.gitignore
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
__pycache__/
|
|
2
|
+
*.py[cod]
|
|
3
|
+
.venv/
|
|
4
|
+
dist/
|
|
5
|
+
build/
|
|
6
|
+
*.egg-info/
|
|
7
|
+
.pytest_cache/
|
|
8
|
+
.ruff_cache/
|
|
9
|
+
.mypy_cache/
|
|
10
|
+
.coverage
|
|
11
|
+
htmlcov/
|
|
12
|
+
# code masters, Athena vocabularies and real data are never committed
|
|
13
|
+
masters/
|
|
14
|
+
athena/
|
|
15
|
+
*.duckdb
|
|
16
|
+
*.parquet
|
|
17
|
+
*.pdf
|
jpomop-0.0.1/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 Koji Miyazawa
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
202
|
+
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
Mapping tables and other data files created by the jpomop project are licensed
|
|
2
|
+
under the Creative Commons Attribution 4.0 International licence (CC BY 4.0).
|
|
3
|
+
https://creativecommons.org/licenses/by/4.0/
|
|
4
|
+
|
|
5
|
+
This does not apply to third-party files that users download themselves
|
|
6
|
+
(code masters, OMOP vocabularies from Athena), which remain under their own terms.
|
jpomop-0.0.1/PKG-INFO
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: jpomop
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: Convert Japanese DPC inpatient data to the OMOP Common Data Model v5.4
|
|
5
|
+
Author: Koji Miyazawa
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
License-File: LICENSE
|
|
8
|
+
License-File: LICENSE-DATA
|
|
9
|
+
Requires-Python: >=3.12
|
|
10
|
+
Requires-Dist: click>=8.1
|
|
11
|
+
Requires-Dist: duckdb>=1.0
|
|
12
|
+
Requires-Dist: pyarrow>=16
|
|
13
|
+
Requires-Dist: pyyaml>=6
|
|
14
|
+
Provides-Extra: dev
|
|
15
|
+
Requires-Dist: hypothesis>=6; extra == 'dev'
|
|
16
|
+
Requires-Dist: mypy>=1.10; extra == 'dev'
|
|
17
|
+
Requires-Dist: openpyxl>=3.1; extra == 'dev'
|
|
18
|
+
Requires-Dist: pytest>=8; extra == 'dev'
|
|
19
|
+
Requires-Dist: ruff>=0.6; extra == 'dev'
|
|
20
|
+
Requires-Dist: types-pyyaml; extra == 'dev'
|
|
21
|
+
Provides-Extra: vocab
|
|
22
|
+
Requires-Dist: openpyxl>=3.1; extra == 'vocab'
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
|
|
25
|
+
# jpomop
|
|
26
|
+
|
|
27
|
+
jpomop converts Japanese DPC inpatient data to the OMOP Common Data Model v5.4.
|
|
28
|
+
It reads two DPC files: Form 1 (様式1) and the EF file (入院EF統合ファイル).
|
|
29
|
+
|
|
30
|
+
I wrote jpomop using the public DPC specification from the Ministry of Health, Labour and Welfare.
|
|
31
|
+
This repository has no hospital data or code masters.
|
|
32
|
+
|
|
33
|
+
## Status
|
|
34
|
+
|
|
35
|
+
jpomop is in early development.
|
|
36
|
+
It can read and check the two files and write eight CDM tables.
|
|
37
|
+
I tested it with synthetic data and the examples in the specification.
|
|
38
|
+
I have not tried it with real hospital data or measured mapping rates with a full Athena vocabulary yet.
|
|
39
|
+
|
|
40
|
+
I plan to release v0.1 at the end of November 2026.
|
|
41
|
+
|
|
42
|
+
## Try it
|
|
43
|
+
|
|
44
|
+
```sh
|
|
45
|
+
pip install jpomop
|
|
46
|
+
jpomop synth --n 100 --out synth/
|
|
47
|
+
jpomop validate --yoshiki1 synth/yoshiki1.txt --ef synth/ef.txt
|
|
48
|
+
jpomop convert --yoshiki1 synth/yoshiki1.txt --ef synth/ef.txt --out cdm.duckdb
|
|
49
|
+
jpomop report --cdm cdm.duckdb
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
`synth` makes fake data for 100 patients, and you can change the number with `--n`.
|
|
53
|
+
|
|
54
|
+
`validate` checks the files against the FY2026 specification and lists the problems it finds.
|
|
55
|
+
|
|
56
|
+
Without `--vocab`, the concept IDs for diagnoses and drugs are 0.
|
|
57
|
+
The original codes stay in the source value columns.
|
|
58
|
+
To map diagnoses and drugs, build a vocabulary first:
|
|
59
|
+
|
|
60
|
+
```sh
|
|
61
|
+
jpomop vocab build --athena athena/ --drug-master y_ALL20261001.csv \
|
|
62
|
+
--kimura rxnorm_mapping.tsv --out vocab.duckdb
|
|
63
|
+
jpomop convert ... --vocab vocab.duckdb
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
You need the following three sources, and you must download them yourself.
|
|
67
|
+
|
|
68
|
+
- Athena vocabularies: ICD10, SNOMED, RxNorm and RxNorm Extension (https://athena.ohdsi.org)
|
|
69
|
+
- The drug master (医薬品マスター, `y_*.csv`) (https://www.hpdx.or.jp/seikyushiharai/tensuhyo/kihonmasta/kihonmasta_04.html)
|
|
70
|
+
- The drug mapping table by Kimura et al. 2025, CC BY 4.0 (https://doi.org/10.17632/y3756v8237.1)
|
|
71
|
+
|
|
72
|
+
## Walkthrough
|
|
73
|
+
|
|
74
|
+
[examples/walkthrough_en.ipynb](https://github.com/kojikojikojikoji/jpomop/blob/main/examples/walkthrough_en.ipynb) runs every step on 100 invented patients.
|
|
75
|
+
It shows the input files, the checks and each CDM table for one patient.
|
|
76
|
+
A Japanese version is in [examples/walkthrough_ja.ipynb](https://github.com/kojikojikojikoji/jpomop/blob/main/examples/walkthrough_ja.ipynb).
|
|
77
|
+
|
|
78
|
+
## How each part is converted
|
|
79
|
+
|
|
80
|
+
| DPC | CDM table | Notes |
|
|
81
|
+
|---|---|---|
|
|
82
|
+
| Form 1, one form per stay | `person`, `visit_occurrence`, `observation_period` | Patient IDs are hashed. Some form types are counted but not converted. See below. |
|
|
83
|
+
| EF, ward code for each day | `visit_detail` | One row for each run of days on the same ward. |
|
|
84
|
+
| Form 1, diagnoses (ICD-10) | `condition_occurrence` | Form 1 has no date for each diagnosis, so the start date is the admission date. Suspected diagnoses (modifier 8002) are left out and counted. |
|
|
85
|
+
| EF, codes that start with 6 | `drug_exposure` | Mapped through the NHI drug price code. Drugs that patients bring from home are left out. |
|
|
86
|
+
| EF, codes that start with 1 | `procedure_occurrence` | The concept ID is 0 for now. The DPC code stays as the source value. Room and meal charges are left out. |
|
|
87
|
+
| Form 1, discharge outcome 6 or 7 | `death` | The death date is the discharge date. |
|
|
88
|
+
|
|
89
|
+
Form 1 has several form types, and jpomop uses the form for the whole stay.
|
|
90
|
+
It uses the day-90 interim form only when the stay has no whole-stay form yet.
|
|
91
|
+
It counts the ward-group forms and the readmission forms, but it does not convert them.
|
|
92
|
+
These forms cover the same days as the whole-stay forms (specification p42 and p125).
|
|
93
|
+
|
|
94
|
+
## Code masters are not included
|
|
95
|
+
|
|
96
|
+
The code masters (基本マスター) come from 医療情報基盤・診療報酬審査支払機構.
|
|
97
|
+
The website terms say that its documents may not be used or copied without permission.
|
|
98
|
+
So this repository does not include the masters.
|
|
99
|
+
Please download them from https://www.hpdx.or.jp/seikyushiharai/tensuhyo/kihonmasta/index.html.
|
|
100
|
+
|
|
101
|
+
## Sources
|
|
102
|
+
|
|
103
|
+
Each field in the specification files shows the document, the version and the page.
|
|
104
|
+
See [PROVENANCE.md](https://github.com/kojikojikojikoji/jpomop/blob/main/PROVENANCE.md).
|
|
105
|
+
|
|
106
|
+
## Licence
|
|
107
|
+
|
|
108
|
+
The code uses the Apache-2.0 licence.
|
|
109
|
+
Mapping tables made by this project use CC BY 4.0. See [LICENSE-DATA](LICENSE-DATA).
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
## 日本語
|
|
114
|
+
|
|
115
|
+
厚生労働省が公開している DPC 調査の仕様(様式1・入院EF統合ファイル)だけを元に、DPC データを OMOP CDM v5.4 へ変換する Python のプログラムです。病院の実データとマスターは含みません。動作の確認には、このリポジトリで作る架空データと、仕様書の記載例だけを使っています。
|
|
116
|
+
|
|
117
|
+
読み込み・仕様の確認・8つの表への変換までできています。病院の実データでの確認と、Athena の語彙一式での変換率の測定はこれからです。
|
|
118
|
+
|
|
119
|
+
架空の患者 100 人のデータで最初から最後まで動かした例を、[examples/walkthrough_ja.ipynb](https://github.com/kojikojikojikoji/jpomop/blob/main/examples/walkthrough_ja.ipynb) に置いています。
|
|
120
|
+
|
|
121
|
+
マスターは、医療情報基盤・診療報酬審査支払機構のサイトから各自でダウンロードしてください。
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Provenance
|
|
2
|
+
|
|
3
|
+
jpomop is written from public documents only. This file lists each document, the version used, and when it was retrieved. Specification YAML files cite the page number for every field.
|
|
4
|
+
|
|
5
|
+
No code, data, documents or other material from any employer or client of the author were used.
|
|
6
|
+
|
|
7
|
+
## DPC specification
|
|
8
|
+
|
|
9
|
+
| Document | Version | URL | Retrieved | SHA-256 |
|
|
10
|
+
|---|---|---|---|---|
|
|
11
|
+
| DPCの評価・検証等に係る調査(退院患者調査)実施説明資料 | FY2026, 2026-07-17 (244 pages) | https://www.mhlw.go.jp/content/12400000/001738680.pdf | 2026-10-12 | f1a099cb57c14251497863cc1fb46c9186c7febd3a7160dca73f9639383b1ed1 |
|
|
12
|
+
|
|
13
|
+
Terms: the Ministry of Health, Labour and Welfare website allows reuse and modification with attribution (公共データ利用規約 第1.0版, https://www.mhlw.go.jp/chosakuken/index.html). jpomop does not copy the text of the specification. It records field names, lengths, types and page numbers only.
|
|
14
|
+
|
|
15
|
+
The PDF itself is not committed.
|
|
16
|
+
|
|
17
|
+
## Code masters (not redistributed)
|
|
18
|
+
|
|
19
|
+
基本マスター from 医療情報基盤・診療報酬審査支払機構: https://www.hpdx.or.jp/seikyushiharai/tensuhyo/kihonmasta/index.html
|
|
20
|
+
|
|
21
|
+
The site terms (https://www.hpdx.or.jp/riyo.html) prohibit reproduction without permission, so the masters are never committed. Users download them and build the vocabulary locally.
|
|
22
|
+
|
|
23
|
+
Drug master layout: receipt code in field 3 and NHI price listing code (薬価基準収載医薬品コード) in field 32, checked against `y_ALL20261001.csv` (42 fields per row).
|
|
24
|
+
|
|
25
|
+
## Third-party mapping tables (not redistributed)
|
|
26
|
+
|
|
27
|
+
| Table | Licence | Where | Used for |
|
|
28
|
+
|---|---|---|---|
|
|
29
|
+
| Kimura E. et al. A dataset for mapping the Japanese drugs to RxNorm standard concepts. Data in Brief, 2025. doi:10.1016/j.dib.2025.111418 | CC BY 4.0 | https://doi.org/10.17632/y3756v8237.1 | NHI price listing code (`NHIDPLC`) to OMOP concept (`OSV_ID`) |
|
|
30
|
+
| OMOP Standardized Vocabularies (ICD10, SNOMED, RxNorm, RxNorm Extension) | per vocabulary, see Athena | https://athena.ohdsi.org | ICD-10 to SNOMED (`Maps to`) |
|
|
31
|
+
|
|
32
|
+
Users download both themselves; `jpomop vocab build` joins them locally.
|
jpomop-0.0.1/README.md
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# jpomop
|
|
2
|
+
|
|
3
|
+
jpomop converts Japanese DPC inpatient data to the OMOP Common Data Model v5.4.
|
|
4
|
+
It reads two DPC files: Form 1 (様式1) and the EF file (入院EF統合ファイル).
|
|
5
|
+
|
|
6
|
+
I wrote jpomop using the public DPC specification from the Ministry of Health, Labour and Welfare.
|
|
7
|
+
This repository has no hospital data or code masters.
|
|
8
|
+
|
|
9
|
+
## Status
|
|
10
|
+
|
|
11
|
+
jpomop is in early development.
|
|
12
|
+
It can read and check the two files and write eight CDM tables.
|
|
13
|
+
I tested it with synthetic data and the examples in the specification.
|
|
14
|
+
I have not tried it with real hospital data or measured mapping rates with a full Athena vocabulary yet.
|
|
15
|
+
|
|
16
|
+
I plan to release v0.1 at the end of November 2026.
|
|
17
|
+
|
|
18
|
+
## Try it
|
|
19
|
+
|
|
20
|
+
```sh
|
|
21
|
+
pip install jpomop
|
|
22
|
+
jpomop synth --n 100 --out synth/
|
|
23
|
+
jpomop validate --yoshiki1 synth/yoshiki1.txt --ef synth/ef.txt
|
|
24
|
+
jpomop convert --yoshiki1 synth/yoshiki1.txt --ef synth/ef.txt --out cdm.duckdb
|
|
25
|
+
jpomop report --cdm cdm.duckdb
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
`synth` makes fake data for 100 patients, and you can change the number with `--n`.
|
|
29
|
+
|
|
30
|
+
`validate` checks the files against the FY2026 specification and lists the problems it finds.
|
|
31
|
+
|
|
32
|
+
Without `--vocab`, the concept IDs for diagnoses and drugs are 0.
|
|
33
|
+
The original codes stay in the source value columns.
|
|
34
|
+
To map diagnoses and drugs, build a vocabulary first:
|
|
35
|
+
|
|
36
|
+
```sh
|
|
37
|
+
jpomop vocab build --athena athena/ --drug-master y_ALL20261001.csv \
|
|
38
|
+
--kimura rxnorm_mapping.tsv --out vocab.duckdb
|
|
39
|
+
jpomop convert ... --vocab vocab.duckdb
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
You need the following three sources, and you must download them yourself.
|
|
43
|
+
|
|
44
|
+
- Athena vocabularies: ICD10, SNOMED, RxNorm and RxNorm Extension (https://athena.ohdsi.org)
|
|
45
|
+
- The drug master (医薬品マスター, `y_*.csv`) (https://www.hpdx.or.jp/seikyushiharai/tensuhyo/kihonmasta/kihonmasta_04.html)
|
|
46
|
+
- The drug mapping table by Kimura et al. 2025, CC BY 4.0 (https://doi.org/10.17632/y3756v8237.1)
|
|
47
|
+
|
|
48
|
+
## Walkthrough
|
|
49
|
+
|
|
50
|
+
[examples/walkthrough_en.ipynb](https://github.com/kojikojikojikoji/jpomop/blob/main/examples/walkthrough_en.ipynb) runs every step on 100 invented patients.
|
|
51
|
+
It shows the input files, the checks and each CDM table for one patient.
|
|
52
|
+
A Japanese version is in [examples/walkthrough_ja.ipynb](https://github.com/kojikojikojikoji/jpomop/blob/main/examples/walkthrough_ja.ipynb).
|
|
53
|
+
|
|
54
|
+
## How each part is converted
|
|
55
|
+
|
|
56
|
+
| DPC | CDM table | Notes |
|
|
57
|
+
|---|---|---|
|
|
58
|
+
| Form 1, one form per stay | `person`, `visit_occurrence`, `observation_period` | Patient IDs are hashed. Some form types are counted but not converted. See below. |
|
|
59
|
+
| EF, ward code for each day | `visit_detail` | One row for each run of days on the same ward. |
|
|
60
|
+
| Form 1, diagnoses (ICD-10) | `condition_occurrence` | Form 1 has no date for each diagnosis, so the start date is the admission date. Suspected diagnoses (modifier 8002) are left out and counted. |
|
|
61
|
+
| EF, codes that start with 6 | `drug_exposure` | Mapped through the NHI drug price code. Drugs that patients bring from home are left out. |
|
|
62
|
+
| EF, codes that start with 1 | `procedure_occurrence` | The concept ID is 0 for now. The DPC code stays as the source value. Room and meal charges are left out. |
|
|
63
|
+
| Form 1, discharge outcome 6 or 7 | `death` | The death date is the discharge date. |
|
|
64
|
+
|
|
65
|
+
Form 1 has several form types, and jpomop uses the form for the whole stay.
|
|
66
|
+
It uses the day-90 interim form only when the stay has no whole-stay form yet.
|
|
67
|
+
It counts the ward-group forms and the readmission forms, but it does not convert them.
|
|
68
|
+
These forms cover the same days as the whole-stay forms (specification p42 and p125).
|
|
69
|
+
|
|
70
|
+
## Code masters are not included
|
|
71
|
+
|
|
72
|
+
The code masters (基本マスター) come from 医療情報基盤・診療報酬審査支払機構.
|
|
73
|
+
The website terms say that its documents may not be used or copied without permission.
|
|
74
|
+
So this repository does not include the masters.
|
|
75
|
+
Please download them from https://www.hpdx.or.jp/seikyushiharai/tensuhyo/kihonmasta/index.html.
|
|
76
|
+
|
|
77
|
+
## Sources
|
|
78
|
+
|
|
79
|
+
Each field in the specification files shows the document, the version and the page.
|
|
80
|
+
See [PROVENANCE.md](https://github.com/kojikojikojikoji/jpomop/blob/main/PROVENANCE.md).
|
|
81
|
+
|
|
82
|
+
## Licence
|
|
83
|
+
|
|
84
|
+
The code uses the Apache-2.0 licence.
|
|
85
|
+
Mapping tables made by this project use CC BY 4.0. See [LICENSE-DATA](LICENSE-DATA).
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## 日本語
|
|
90
|
+
|
|
91
|
+
厚生労働省が公開している DPC 調査の仕様(様式1・入院EF統合ファイル)だけを元に、DPC データを OMOP CDM v5.4 へ変換する Python のプログラムです。病院の実データとマスターは含みません。動作の確認には、このリポジトリで作る架空データと、仕様書の記載例だけを使っています。
|
|
92
|
+
|
|
93
|
+
読み込み・仕様の確認・8つの表への変換までできています。病院の実データでの確認と、Athena の語彙一式での変換率の測定はこれからです。
|
|
94
|
+
|
|
95
|
+
架空の患者 100 人のデータで最初から最後まで動かした例を、[examples/walkthrough_ja.ipynb](https://github.com/kojikojikojikoji/jpomop/blob/main/examples/walkthrough_ja.ipynb) に置いています。
|
|
96
|
+
|
|
97
|
+
マスターは、医療情報基盤・診療報酬審査支払機構のサイトから各自でダウンロードしてください。
|