aind-data-schema 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.
Files changed (145) hide show
  1. aind-data-schema-0.0.1/.flake8 +7 -0
  2. aind-data-schema-0.0.1/.github/ISSUE_TEMPLATE/bug_report.md +38 -0
  3. aind-data-schema-0.0.1/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
  4. aind-data-schema-0.0.1/.github/ISSUE_TEMPLATE/user-story.md +27 -0
  5. aind-data-schema-0.0.1/.github/workflows/tag_and_publish.yml +166 -0
  6. aind-data-schema-0.0.1/.gitignore +142 -0
  7. aind-data-schema-0.0.1/.readthedocs.yaml +8 -0
  8. aind-data-schema-0.0.1/LICENSE +21 -0
  9. aind-data-schema-0.0.1/PKG-INFO +200 -0
  10. aind-data-schema-0.0.1/README.md +171 -0
  11. aind-data-schema-0.0.1/docs/Makefile +20 -0
  12. aind-data-schema-0.0.1/docs/make.bat +35 -0
  13. aind-data-schema-0.0.1/docs/source/_static/dark-logo.svg +129 -0
  14. aind-data-schema-0.0.1/docs/source/_static/favicon.ico +0 -0
  15. aind-data-schema-0.0.1/docs/source/_static/light-logo.svg +128 -0
  16. aind-data-schema-0.0.1/docs/source/aind_data_schema.behavior.rst +29 -0
  17. aind-data-schema-0.0.1/docs/source/aind_data_schema.core.rst +93 -0
  18. aind-data-schema-0.0.1/docs/source/aind_data_schema.ephys.rst +29 -0
  19. aind-data-schema-0.0.1/docs/source/aind_data_schema.imaging.rst +45 -0
  20. aind-data-schema-0.0.1/docs/source/aind_data_schema.models.rst +117 -0
  21. aind-data-schema-0.0.1/docs/source/aind_data_schema.ophys.rst +29 -0
  22. aind-data-schema-0.0.1/docs/source/aind_data_schema.rst +81 -0
  23. aind-data-schema-0.0.1/docs/source/aind_data_schema.schema_upgrade.rst +21 -0
  24. aind-data-schema-0.0.1/docs/source/aind_data_schema.utils.rst +45 -0
  25. aind-data-schema-0.0.1/docs/source/conf.py +52 -0
  26. aind-data-schema-0.0.1/docs/source/index.rst +102 -0
  27. aind-data-schema-0.0.1/docs/source/modules.rst +7 -0
  28. aind-data-schema-0.0.1/examples/aibs_smartspim_instrument.json +509 -0
  29. aind-data-schema-0.0.1/examples/aibs_smartspim_instrument.py +211 -0
  30. aind-data-schema-0.0.1/examples/aibs_smartspim_procedures.json +261 -0
  31. aind-data-schema-0.0.1/examples/aibs_smartspim_procedures.py +160 -0
  32. aind-data-schema-0.0.1/examples/aind_smartspim_instrument.json +636 -0
  33. aind-data-schema-0.0.1/examples/aind_smartspim_instrument.py +254 -0
  34. aind-data-schema-0.0.1/examples/bergamo_ophys_session.json +144 -0
  35. aind-data-schema-0.0.1/examples/bergamo_ophys_session.py +93 -0
  36. aind-data-schema-0.0.1/examples/data_description.json +61 -0
  37. aind-data-schema-0.0.1/examples/data_description.py +20 -0
  38. aind-data-schema-0.0.1/examples/ephys_rig.json +632 -0
  39. aind-data-schema-0.0.1/examples/ephys_rig.py +201 -0
  40. aind-data-schema-0.0.1/examples/ephys_session.json +121 -0
  41. aind-data-schema-0.0.1/examples/ephys_session.py +73 -0
  42. aind-data-schema-0.0.1/examples/exaspim_acquisition.json +179 -0
  43. aind-data-schema-0.0.1/examples/exaspim_acquisition.py +110 -0
  44. aind-data-schema-0.0.1/examples/exaspim_instrument.json +458 -0
  45. aind-data-schema-0.0.1/examples/exaspim_instrument.py +205 -0
  46. aind-data-schema-0.0.1/examples/fip_ophys_rig.json +888 -0
  47. aind-data-schema-0.0.1/examples/fip_ophys_rig.py +283 -0
  48. aind-data-schema-0.0.1/examples/multiplane_ophys_session.json +276 -0
  49. aind-data-schema-0.0.1/examples/multiplane_ophys_session.py +204 -0
  50. aind-data-schema-0.0.1/examples/ophys_procedures.json +243 -0
  51. aind-data-schema-0.0.1/examples/ophys_procedures.py +156 -0
  52. aind-data-schema-0.0.1/examples/ophys_session.json +89 -0
  53. aind-data-schema-0.0.1/examples/ophys_session.py +61 -0
  54. aind-data-schema-0.0.1/examples/procedures.json +105 -0
  55. aind-data-schema-0.0.1/examples/procedures.py +78 -0
  56. aind-data-schema-0.0.1/examples/processing.json +97 -0
  57. aind-data-schema-0.0.1/examples/processing.py +78 -0
  58. aind-data-schema-0.0.1/examples/subject.json +48 -0
  59. aind-data-schema-0.0.1/examples/subject.py +29 -0
  60. aind-data-schema-0.0.1/pyproject.toml +91 -0
  61. aind-data-schema-0.0.1/schemas/acquisition_schema.json +3658 -0
  62. aind-data-schema-0.0.1/schemas/data_description_schema.json +1412 -0
  63. aind-data-schema-0.0.1/schemas/instrument_schema.json +7865 -0
  64. aind-data-schema-0.0.1/schemas/metadata_schema.json +28001 -0
  65. aind-data-schema-0.0.1/schemas/mri_session_schema.json +3398 -0
  66. aind-data-schema-0.0.1/schemas/procedures_schema.json +8994 -0
  67. aind-data-schema-0.0.1/schemas/processing_schema.json +374 -0
  68. aind-data-schema-0.0.1/schemas/rig_schema.json +14935 -0
  69. aind-data-schema-0.0.1/schemas/session_schema.json +6328 -0
  70. aind-data-schema-0.0.1/schemas/subject_schema.json +968 -0
  71. aind-data-schema-0.0.1/setup.cfg +4 -0
  72. aind-data-schema-0.0.1/setup.py +4 -0
  73. aind-data-schema-0.0.1/src/aind_data_schema/__init__.py +4 -0
  74. aind-data-schema-0.0.1/src/aind_data_schema/base.py +89 -0
  75. aind-data-schema-0.0.1/src/aind_data_schema/core/__init__.py +1 -0
  76. aind-data-schema-0.0.1/src/aind_data_schema/core/acquisition.py +104 -0
  77. aind-data-schema-0.0.1/src/aind_data_schema/core/data_description.py +385 -0
  78. aind-data-schema-0.0.1/src/aind_data_schema/core/instrument.py +111 -0
  79. aind-data-schema-0.0.1/src/aind_data_schema/core/metadata.py +234 -0
  80. aind-data-schema-0.0.1/src/aind_data_schema/core/mri_session.py +124 -0
  81. aind-data-schema-0.0.1/src/aind_data_schema/core/procedures.py +589 -0
  82. aind-data-schema-0.0.1/src/aind_data_schema/core/processing.py +97 -0
  83. aind-data-schema-0.0.1/src/aind_data_schema/core/rig.py +228 -0
  84. aind-data-schema-0.0.1/src/aind_data_schema/core/session.py +413 -0
  85. aind-data-schema-0.0.1/src/aind_data_schema/core/subject.py +144 -0
  86. aind-data-schema-0.0.1/src/aind_data_schema/imaging/__init__.py +1 -0
  87. aind-data-schema-0.0.1/src/aind_data_schema/imaging/tile.py +58 -0
  88. aind-data-schema-0.0.1/src/aind_data_schema/models/__init__.py +1 -0
  89. aind-data-schema-0.0.1/src/aind_data_schema/models/coordinates.py +180 -0
  90. aind-data-schema-0.0.1/src/aind_data_schema/models/devices.py +827 -0
  91. aind-data-schema-0.0.1/src/aind_data_schema/models/harp_types.py +110 -0
  92. aind-data-schema-0.0.1/src/aind_data_schema/models/modalities.py +144 -0
  93. aind-data-schema-0.0.1/src/aind_data_schema/models/organizations.py +843 -0
  94. aind-data-schema-0.0.1/src/aind_data_schema/models/pid_names.py +24 -0
  95. aind-data-schema-0.0.1/src/aind_data_schema/models/platforms.py +150 -0
  96. aind-data-schema-0.0.1/src/aind_data_schema/models/process_names.py +43 -0
  97. aind-data-schema-0.0.1/src/aind_data_schema/models/reagent.py +20 -0
  98. aind-data-schema-0.0.1/src/aind_data_schema/models/registry.py +68 -0
  99. aind-data-schema-0.0.1/src/aind_data_schema/models/species.py +77 -0
  100. aind-data-schema-0.0.1/src/aind_data_schema/models/stimulus.py +173 -0
  101. aind-data-schema-0.0.1/src/aind_data_schema/models/units.py +123 -0
  102. aind-data-schema-0.0.1/src/aind_data_schema/utils/__init__.py +1 -0
  103. aind-data-schema-0.0.1/src/aind_data_schema/utils/json_writer.py +96 -0
  104. aind-data-schema-0.0.1/src/aind_data_schema/utils/schema_version_bump.py +168 -0
  105. aind-data-schema-0.0.1/src/aind_data_schema.egg-info/PKG-INFO +200 -0
  106. aind-data-schema-0.0.1/src/aind_data_schema.egg-info/SOURCES.txt +143 -0
  107. aind-data-schema-0.0.1/src/aind_data_schema.egg-info/dependency_links.txt +1 -0
  108. aind-data-schema-0.0.1/src/aind_data_schema.egg-info/requires.txt +22 -0
  109. aind-data-schema-0.0.1/src/aind_data_schema.egg-info/top_level.txt +1 -0
  110. aind-data-schema-0.0.1/tests/__init__.py +1 -0
  111. aind-data-schema-0.0.1/tests/resources/ephys_data_description/data_description_0.10.0.json +49 -0
  112. aind-data-schema-0.0.1/tests/resources/ephys_data_description/data_description_0.3.0.json +24 -0
  113. aind-data-schema-0.0.1/tests/resources/ephys_data_description/data_description_0.3.0_wrong_field.json +24 -0
  114. aind-data-schema-0.0.1/tests/resources/ephys_data_description/data_description_0.4.0.json +36 -0
  115. aind-data-schema-0.0.1/tests/resources/ephys_data_description/data_description_0.6.0.json +36 -0
  116. aind-data-schema-0.0.1/tests/resources/ephys_data_description/data_description_0.6.2.json +40 -0
  117. aind-data-schema-0.0.1/tests/resources/ephys_data_description/data_description_0.6.2_wrong_field.json +40 -0
  118. aind-data-schema-0.0.1/tests/resources/schema_version_bump/core/test_schema.py +144 -0
  119. aind-data-schema-0.0.1/tests/resources/schema_version_bump/old_schemas/test_schema.json +0 -0
  120. aind-data-schema-0.0.1/tests/resources/schema_version_comparison/new_schemas/data_description_schema.json +293 -0
  121. aind-data-schema-0.0.1/tests/resources/schema_version_comparison/new_schemas/subject_schema.json +272 -0
  122. aind-data-schema-0.0.1/tests/resources/schema_version_comparison/new_schemas_bad_versions/data_description_schema.json +292 -0
  123. aind-data-schema-0.0.1/tests/resources/schema_version_comparison/new_schemas_bad_versions/subject_schema.json +272 -0
  124. aind-data-schema-0.0.1/tests/resources/schema_version_comparison/old_schemas/data_description_schema.json +169 -0
  125. aind-data-schema-0.0.1/tests/resources/schema_version_comparison/old_schemas/subject_schema.json +241 -0
  126. aind-data-schema-0.0.1/tests/test_base.py +34 -0
  127. aind-data-schema-0.0.1/tests/test_bump_schema_versions.py +107 -0
  128. aind-data-schema-0.0.1/tests/test_check_schema_versions.py +106 -0
  129. aind-data-schema-0.0.1/tests/test_data_description.py +387 -0
  130. aind-data-schema-0.0.1/tests/test_examples.py +49 -0
  131. aind-data-schema-0.0.1/tests/test_imaging.py +346 -0
  132. aind-data-schema-0.0.1/tests/test_json_writer.py +112 -0
  133. aind-data-schema-0.0.1/tests/test_metadata.py +210 -0
  134. aind-data-schema-0.0.1/tests/test_models.py +57 -0
  135. aind-data-schema-0.0.1/tests/test_procedures.py +346 -0
  136. aind-data-schema-0.0.1/tests/test_processing.py +63 -0
  137. aind-data-schema-0.0.1/tests/test_rig.py +331 -0
  138. aind-data-schema-0.0.1/tests/test_session.py +100 -0
  139. aind-data-schema-0.0.1/tests/test_subject.py +97 -0
  140. aind-data-schema-0.0.1/tests/test_units.py +30 -0
  141. aind-data-schema-0.0.1/wokflows/ci.yml +69 -0
  142. aind-data-schema-0.0.1/wokflows/publish_dev.yml +37 -0
  143. aind-data-schema-0.0.1/wokflows/publish_prod.yml +37 -0
  144. aind-data-schema-0.0.1/wokflows/tag.yml +60 -0
  145. aind-data-schema-0.0.1/wokflows/update_schemas.yml +31 -0
@@ -0,0 +1,7 @@
1
+ [flake8]
2
+ exclude =
3
+ .git,
4
+ __pycache__,
5
+ build
6
+ max-complexity = 10
7
+ max-line-length = 120
@@ -0,0 +1,38 @@
1
+ ---
2
+ name: Bug report
3
+ about: Create a report to help us improve
4
+ title: ''
5
+ labels: ''
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ **Describe the bug**
11
+ A clear and concise description of what the bug is.
12
+
13
+ **To Reproduce**
14
+ Steps to reproduce the behavior:
15
+ 1. Go to '...'
16
+ 2. Click on '....'
17
+ 3. Scroll down to '....'
18
+ 4. See error
19
+
20
+ **Expected behavior**
21
+ A clear and concise description of what you expected to happen.
22
+
23
+ **Screenshots**
24
+ If applicable, add screenshots to help explain your problem.
25
+
26
+ **Desktop (please complete the following information):**
27
+ - OS: [e.g. iOS]
28
+ - Browser [e.g. chrome, safari]
29
+ - Version [e.g. 22]
30
+
31
+ **Smartphone (please complete the following information):**
32
+ - Device: [e.g. iPhone6]
33
+ - OS: [e.g. iOS8.1]
34
+ - Browser [e.g. stock browser, safari]
35
+ - Version [e.g. 22]
36
+
37
+ **Additional context**
38
+ Add any other context about the problem here.
@@ -0,0 +1,20 @@
1
+ ---
2
+ name: Feature request
3
+ about: Suggest an idea for this project
4
+ title: ''
5
+ labels: ''
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ **Is your feature request related to a problem? Please describe.**
11
+ A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12
+
13
+ **Describe the solution you'd like**
14
+ A clear and concise description of what you want to happen.
15
+
16
+ **Describe alternatives you've considered**
17
+ A clear and concise description of any alternative solutions or features you've considered.
18
+
19
+ **Additional context**
20
+ Add any other context or screenshots about the feature request here.
@@ -0,0 +1,27 @@
1
+ ---
2
+ name: User story
3
+ about: This template provides a basic structure for user story issues.
4
+ title: ''
5
+ labels: ''
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ # User story
11
+ As a ..., I want to ..., so I can ...
12
+
13
+ *Ideally, this is in the issue title, but if not, you can put it here. If so, delete this section.*
14
+
15
+ # Acceptance criteria
16
+ - [ ] This is something that can be verified to show that this user story is satisfied.
17
+
18
+ # Sprint Ready Checklist
19
+ - [ ] 1. Acceptance criteria defined
20
+ - [ ] 2. Team understands acceptance criteria
21
+ - [ ] 3. Team has defined solution / steps to satisfy acceptance criteria
22
+ - [ ] 4. Acceptance criteria is verifiable / testable
23
+ - [ ] 5. External / 3rd Party dependencies identified
24
+ - [ ] 6. Ticket is prioritized and sized
25
+
26
+ # Notes
27
+ *Add any helpful notes here.*
@@ -0,0 +1,166 @@
1
+ name: Tag and Publish
2
+ on:
3
+ push:
4
+ branches:
5
+ - main
6
+
7
+ jobs:
8
+ bump_versions_and_update_schemas:
9
+ runs-on: ubuntu-latest
10
+ env:
11
+ OUTPUT_DIR: 'schemas'
12
+ steps:
13
+ - uses: actions/checkout@v3
14
+ with:
15
+ ref: ${{ env.DEFAULT_BRANCH }}
16
+ fetch-depth: 0
17
+ token: ${{ secrets.SERVICE_TOKEN }}
18
+ - name: Set up Python 3.8
19
+ uses: actions/setup-python@v3
20
+ with:
21
+ python-version: 3.8
22
+ - name: Install dependencies
23
+ run: python -m pip install -e .[dev] --no-cache-dir
24
+ - name: Bump schema versions
25
+ run: |
26
+ python -m aind_data_schema.utils.schema_version_bump
27
+ echo "Finished schema version bump"
28
+ - name: Update schemas
29
+ run: |
30
+ rm -rf $OUTPUT_DIR
31
+ python -m pip install -e .
32
+ python -m aind_data_schema.utils.json_writer --output $OUTPUT_DIR
33
+ - name: Create example schemas
34
+ run: |
35
+ cd examples
36
+ for script in ./*.py; do
37
+ python "$script"
38
+ done
39
+ - name: Commit changes
40
+ uses: EndBug/add-and-commit@v9
41
+ with:
42
+ default_author: github_actions
43
+ message: "bump schema version [skip actions]"
44
+ add: '["src", "schemas", "examples"]'
45
+
46
+ update_docs:
47
+ needs: bump_versions_and_update_schemas
48
+ runs-on: ubuntu-latest
49
+ continue-on-error: true
50
+ env:
51
+ DIAGRAM_DIRECTORY: ./docs/source/_static/diagrams
52
+ steps:
53
+ - uses: actions/checkout@v3
54
+ with:
55
+ ref: ${{ env.DEFAULT_BRANCH }}
56
+ fetch-depth: 0
57
+ token: ${{ secrets.SERVICE_TOKEN }}
58
+ - name: Set up Python 3.8
59
+ uses: actions/setup-python@v2
60
+ with:
61
+ python-version: 3.8
62
+ - name: Install dependencies
63
+ run: python -m pip install -e .[dev] --no-cache-dir
64
+ - name: Generate new rst files
65
+ run: |
66
+ sphinx-apidoc -o docs/source/ src
67
+ sphinx-build -b html docs/source/ docs/build/html
68
+ - name: Commit changes
69
+ uses: EndBug/add-and-commit@v9
70
+ with:
71
+ default_author: github_actions
72
+ message: "updates diagrams [skip actions]"
73
+ add: '["*.png", "*.rst"]'
74
+
75
+ tag:
76
+ needs: update_docs
77
+ uses: AllenNeuralDynamics/aind-github-actions/.github/workflows/tag.yml@main
78
+ secrets:
79
+ SERVICE_TOKEN: ${{ secrets.SERVICE_TOKEN }} # required
80
+
81
+ publish:
82
+ needs: tag
83
+ runs-on: ubuntu-latest
84
+ steps:
85
+ - uses: actions/checkout@v2
86
+ - name: Pull latest changes
87
+ run: git pull origin main
88
+ - name: Set up Python 3.8
89
+ uses: actions/setup-python@v2
90
+ with:
91
+ python-version: 3.8
92
+ - name: Install dependencies
93
+ run: |
94
+ pip install --upgrade setuptools wheel twine build
95
+ python -m build
96
+ twine check dist/*
97
+ - name: Publish on PyPI
98
+ uses: pypa/gh-action-pypi-publish@release/v1.5
99
+ with:
100
+ password: ${{ secrets.AIND_PYPI_TOKEN }}
101
+
102
+ upload_schemas_prod:
103
+ needs: publish
104
+ runs-on: ubuntu-latest
105
+ permissions:
106
+ id-token: write
107
+ contents: read
108
+ env:
109
+ AWS_DATA_SCHEMA_ROLE: ${{ secrets.AWS_DATA_SCHEMA_ROLE_PROD}}
110
+ AWS_DATA_SCHEMA_BUCKET: ${{ vars.AWS_DATA_SCHEMA_BUCKET_PROD }}
111
+ AWS_REGION: ${{ vars.AWS_REGION_PROD }}
112
+ TEMP_DIR: 'temp_schemas'
113
+ S3_PREFIX: 'schemas'
114
+ steps:
115
+ - uses: actions/checkout@master
116
+ - name: Pull latest changes
117
+ run: git pull origin main
118
+ - name: Set up Python 3.8
119
+ uses: actions/setup-python@v3
120
+ with:
121
+ python-version: 3.8
122
+ - name: Configure aws credentials
123
+ uses: aws-actions/configure-aws-credentials@v2
124
+ with:
125
+ role-to-assume: ${{ env.AWS_DATA_SCHEMA_ROLE }}
126
+ role-session-name: github-schema-upload-session
127
+ aws-region: ${{ env.AWS_REGION }}
128
+ - name: Create and upload schemas
129
+ run: |
130
+ python -m pip install -e .
131
+ python -m aind_data_schema.utils.json_writer --output $TEMP_DIR --attach-version
132
+ python -m pip install awscli
133
+ aws s3 sync $TEMP_DIR s3://${AWS_DATA_SCHEMA_BUCKET}/$S3_PREFIX
134
+
135
+ upload_schemas_dev:
136
+ needs: upload_schemas_prod
137
+ runs-on: ubuntu-latest
138
+ permissions:
139
+ id-token: write
140
+ contents: read
141
+ env:
142
+ AWS_DATA_SCHEMA_ROLE: ${{ secrets.AWS_DATA_SCHEMA_ROLE_DEV }}
143
+ AWS_DATA_SCHEMA_BUCKET: ${{ vars.AWS_DATA_SCHEMA_BUCKET_DEV }}
144
+ AWS_REGION : ${{ vars.AWS_REGION_DEV }}
145
+ TEMP_DIR: 'temp_schemas'
146
+ S3_PREFIX: 'schemas'
147
+ steps:
148
+ - uses: actions/checkout@master
149
+ - name: Pull latest changes
150
+ run: git pull origin main
151
+ - name: Set up Python 3.8
152
+ uses: actions/setup-python@v3
153
+ with:
154
+ python-version: 3.8
155
+ - name: Configure aws credentials
156
+ uses: aws-actions/configure-aws-credentials@v2
157
+ with:
158
+ role-to-assume: ${{ env.AWS_DATA_SCHEMA_ROLE }}
159
+ role-session-name: github-schema-upload-session
160
+ aws-region: ${{ env.AWS_REGION }}
161
+ - name: Create and upload schemas
162
+ run: |
163
+ python -m pip install -e .
164
+ python -m aind_data_schema.utils.json_writer --output $TEMP_DIR --attach-version
165
+ python -m pip install awscli
166
+ aws s3 sync $TEMP_DIR s3://${AWS_DATA_SCHEMA_BUCKET}/$S3_PREFIX
@@ -0,0 +1,142 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ pip-wheel-metadata/
24
+ share/python-wheels/
25
+ *.egg-info/
26
+ .installed.cfg
27
+ *.egg
28
+ MANIFEST
29
+
30
+ # PyInstaller
31
+ # Usually these files are written by a python script from a template
32
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
33
+ *.manifest
34
+ *.spec
35
+
36
+ # Installer logs
37
+ pip-log.txt
38
+ pip-delete-this-directory.txt
39
+
40
+ # Unit test / coverage reports
41
+ htmlcov/
42
+ .tox/
43
+ .nox/
44
+ .coverage
45
+ .coverage.*
46
+ .cache
47
+ nosetests.xml
48
+ coverage.xml
49
+ *.cover
50
+ *.py,cover
51
+ .hypothesis/
52
+ .pytest_cache/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ target/
76
+
77
+ # Jupyter Notebook
78
+ .ipynb_checkpoints
79
+
80
+ # IPython
81
+ profile_default/
82
+ ipython_config.py
83
+
84
+ # pyenv
85
+ .python-version
86
+
87
+ # pipenv
88
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
89
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
90
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
91
+ # install all needed dependencies.
92
+ #Pipfile.lock
93
+
94
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow
95
+ __pypackages__/
96
+
97
+ # Celery stuff
98
+ celerybeat-schedule
99
+ celerybeat.pid
100
+
101
+ # SageMath parsed files
102
+ *.sage.py
103
+
104
+ # Environments
105
+ .env
106
+ .venv
107
+ env/
108
+ venv/
109
+ ENV/
110
+ env.bak/
111
+ venv.bak/
112
+
113
+ # Spyder project settings
114
+ .spyderproject
115
+ .spyproject
116
+
117
+ # Rope project settings
118
+ .ropeproject
119
+
120
+ # mkdocs documentation
121
+ /site
122
+
123
+ # mypy
124
+ .mypy_cache/
125
+ .dmypy.json
126
+ dmypy.json
127
+
128
+ # Pyre type checker
129
+ .pyre/
130
+
131
+ # PyCharm
132
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
133
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
134
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
135
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
136
+ .idea/
137
+
138
+ # MacOs
139
+ **/.DS_Store
140
+
141
+ # Jupyter
142
+ notebook/
@@ -0,0 +1,8 @@
1
+ version: 2
2
+
3
+ python:
4
+ install:
5
+ - method: pip
6
+ path: .
7
+ extra_requirements:
8
+ - dev
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 Allen Institute for Neural Dynamics
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,200 @@
1
+ Metadata-Version: 2.1
2
+ Name: aind-data-schema
3
+ Version: 0.0.1
4
+ Summary: A library that defines AIND data schema and validates JSON files.
5
+ License: MIT
6
+ Classifier: Programming Language :: Python :: 3
7
+ Requires-Python: >=3.8
8
+ Description-Content-Type: text/markdown
9
+ License-File: LICENSE
10
+ Requires-Dist: dictdiffer
11
+ Requires-Dist: pydantic>2.0
12
+ Requires-Dist: inflection
13
+ Requires-Dist: jsonschema
14
+ Requires-Dist: semver
15
+ Provides-Extra: dev
16
+ Requires-Dist: aind_data_schema[docs]; extra == "dev"
17
+ Requires-Dist: aind_data_schema[linters]; extra == "dev"
18
+ Provides-Extra: linters
19
+ Requires-Dist: codespell; extra == "linters"
20
+ Requires-Dist: black; extra == "linters"
21
+ Requires-Dist: coverage; extra == "linters"
22
+ Requires-Dist: flake8; extra == "linters"
23
+ Requires-Dist: interrogate; extra == "linters"
24
+ Requires-Dist: isort; extra == "linters"
25
+ Provides-Extra: docs
26
+ Requires-Dist: Sphinx; extra == "docs"
27
+ Requires-Dist: sphinx-jinja; extra == "docs"
28
+ Requires-Dist: furo; extra == "docs"
29
+
30
+ # aind-data-schema
31
+
32
+ [![License](https://img.shields.io/badge/license-MIT-brightgreen)](LICENSE)
33
+ ![Code Style](https://img.shields.io/badge/code%20style-black-black)
34
+ [![Documentation Status](https://readthedocs.org/projects/aind-data-schema/badge/?version=latest)](https://aind-data-schema.readthedocs.io/en/latest/?badge=latest)
35
+
36
+ A library that defines [AIND](https://alleninstitute.org/what-we-do/brain-science/research/allen-institute-neural-dynamics/) data schema and validates JSON files.
37
+
38
+ User documentation available on [readthedocs](https://aind-data-schema.readthedocs.io/en/latest/).
39
+
40
+ ## Overview
41
+
42
+ This repository contains the schemas needed to ingest and validate metadata that are essential to ensuring [AIND](https://alleninstitute.org/what-we-do/brain-science/research/allen-institute-neural-dynamics/) data collection is completely reproducible. Our general approach is to semantically version core schema classes and include those version numbers in serialized metadata so that we can flexibly evolve the schemas over time without requiring difficult data migrations. In the future, we will provide a browsable list of these classes rendered to [JSONschema](https://json-schema.org/), including all historic versions.
43
+
44
+ Be aware that this package is still under heavy preliminary development. Expect breaking changes regularly, although we will communicate these through semantic versioning.
45
+
46
+ A simple example:
47
+
48
+ ```python
49
+ import datetime
50
+
51
+ from aind_data_schema.subject import Housing, Subject
52
+
53
+ t = datetime.datetime(2022, 11, 22, 8, 43, 00)
54
+
55
+ s = Subject(
56
+ species="Mus musculus",
57
+ subject_id="12345",
58
+ sex="Male",
59
+ date_of_birth=t.date(),
60
+ genotype="Emx1-IRES-Cre;Camk2a-tTA;Ai93(TITL-GCaMP6f)",
61
+ housing=Housing(home_cage_enrichment=["Running wheel"], cage_id="123"),
62
+ background_strain="C57BL/6J",
63
+ )
64
+
65
+ s.write_standard_file() # writes subject.json
66
+ ```
67
+
68
+ ```json
69
+ {
70
+ "describedBy": "https://raw.githubusercontent.com/AllenNeuralDynamics/aind-data-schema-test/main/src/aind_data_schema/subject.py",
71
+ "schema_version": "0.3.0",
72
+ "species": "Mus musculus",
73
+ "subject_id": "12345",
74
+ "sex": "Male",
75
+ "date_of_birth": "2022-11-22",
76
+ "genotype": "Emx1-IRES-Cre;Camk2a-tTA;Ai93(TITL-GCaMP6f)",
77
+ "mgi_allele_ids": null,
78
+ "background_strain": "C57BL/6J",
79
+ "source": null,
80
+ "rrid": null,
81
+ "restrictions": null,
82
+ "breeding_group": null,
83
+ "maternal_id": null,
84
+ "maternal_genotype": null,
85
+ "paternal_id": null,
86
+ "paternal_genotype": null,
87
+ "wellness_reports": null,
88
+ "housing": {
89
+ "cage_id": "123",
90
+ "room_id": null,
91
+ "light_cycle": null,
92
+ "home_cage_enrichment": [
93
+ "Running wheel"
94
+ ],
95
+ "cohoused_subjects": null
96
+ },
97
+ "notes": null
98
+ }
99
+ ```
100
+
101
+ ## Installing and Upgrading
102
+
103
+ To install the latest version:
104
+ ```
105
+ pip install aind-data-schema
106
+ ```
107
+
108
+ Every merge to the `main` branch is automatically tagged with a new major/minor/patch version and uploaded to PyPI. To upgrade to the latest version:
109
+ ```
110
+ pip install aind-data-schema --upgrade
111
+ ```
112
+
113
+ To develop the code, check out this repo and run the following in the cloned directory:
114
+ ```
115
+ pip install -e .[dev]
116
+ ```
117
+
118
+ ## Contributing
119
+
120
+ If you've found a bug in the schemas or would like to make a minor change, open an [Issue](https://github.com/AllenNeuralDynamics/aind-data-schema-test/issues) on this repository. If you'd like to propose a large change or addition, or generally have a question about how things work, head start a new [Discussion](https://github.com/AllenNeuralDynamics/aind-data-schema-test/discussions)!
121
+
122
+
123
+ ### Linters and testing
124
+
125
+ There are several libraries used to run linters, check documentation, and run tests.
126
+
127
+ - To run tests locally, navigate to AIND-DATA-SCHEMA directory in terminal and run (this will not run any on-line only tests):
128
+
129
+ ```
130
+ python -m unittest
131
+ ```
132
+
133
+ - Please test your changes using the **coverage** library, which will run the tests and log a coverage report:
134
+
135
+ ```
136
+ coverage run -m unittest discover && coverage report
137
+ ```
138
+
139
+ - To test any of the following modules, conda/pip install the relevant package (interrogate, flake8, black, isort), navigate to relevant directory, and run any of the following commands in place of [command]:
140
+
141
+ ```
142
+ [command] -v .
143
+ ```
144
+
145
+ - Use **interrogate** to check that modules, methods, etc. have been documented thoroughly:
146
+
147
+ ```
148
+ interrogate .
149
+ ```
150
+
151
+ - Use **flake8** to check that code is up to standards (no unused imports, etc.):
152
+
153
+ ```
154
+ flake8 .
155
+ ```
156
+
157
+ - Use **black** to automatically format the code into PEP standards:
158
+
159
+ ```
160
+ black .
161
+ ```
162
+
163
+ - Use **isort** to automatically sort import statements:
164
+
165
+ ```
166
+ isort .
167
+ ```
168
+
169
+ ### Pull requests
170
+
171
+ For internal members, please create a branch. For external members, please fork the repo and open a pull request from the fork. We'll primarily use [Angular](https://github.com/angular/angular/blob/main/CONTRIBUTING.md#commit) style for commit messages. Roughly, they should follow the pattern:
172
+ ```
173
+ <type>(<scope>): <short summary>
174
+ ```
175
+
176
+ where scope (optional) describes the packages affected by the code changes and type (mandatory) is one of:
177
+
178
+ - **build**: Changes that affect the build system or external dependencies (example scopes: pyproject.toml, setup.py)
179
+ - **ci**: Changes to our CI configuration files and scripts (examples: .github/workflows/ci.yml)
180
+ - **docs**: Documentation only changes
181
+ - **feat**: A new feature
182
+ - **fix**: A bug fix
183
+ - **perf**: A code change that improves performance
184
+ - **refactor**: A code change that neither fixes a bug nor adds a feature
185
+ - **test**: Adding missing tests or correcting existing tests
186
+
187
+ ### Documentation
188
+
189
+ To generate the rst files source files for documentation, run:
190
+
191
+ ```
192
+ sphinx-apidoc -o docs/source/ src
193
+ ```
194
+
195
+ Then to create the documentation html files, run:
196
+ ```
197
+ sphinx-build -b html docs/source/ docs/build/html
198
+ ```
199
+
200
+ More info on sphinx installation can be found here: https://www.sphinx-doc.org/en/master/usage/installation.html