Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- .gitattributes +42 -0
- SYNC_README.md +89 -0
- __pycache__/sync_dataset.cpython-313.pyc +0 -0
- delete_old_folders.py +42 -0
- documents/10.1001_jama.2018.20579/sap.pdf +0 -0
- documents/10.1001_jama.2019.0071/protocol.pdf +3 -0
- documents/10.1001_jama.2019.0071/sap.pdf +3 -0
- documents/10.1001_jama.2019.0557/protocol.pdf +3 -0
- documents/10.1001_jama.2019.0557/sap.pdf +3 -0
- documents/10.1001_jama.2019.12618/protocol.pdf +3 -0
- documents/10.1001_jama.2019.12618/sap.pdf +3 -0
- documents/10.1001_jama.2019.1660/protocol.pdf +3 -0
- documents/10.1001_jama.2019.1660/sap.pdf +3 -0
- documents/10.1016_s0140-6736(17)33297-x/protocol.pdf +3 -0
- documents/10.1016_s0140-6736(17)33297-x/sap.pdf +3 -0
- documents/10.1016_s0140-6736(18)32321-3/protocol.pdf +3 -0
- documents/10.1016_s0140-6736(18)32321-3/sap.pdf +3 -0
- documents/10.1016_s0140-6736(19)30772-x/protocol.pdf +3 -0
- documents/10.1016_s0140-6736(19)30772-x/sap.pdf +3 -0
- documents/10.1016_s0140-6736(19)31150-x/protocol.pdf +3 -0
- documents/10.1016_s0140-6736(19)31388-1/protocol.pdf +3 -0
- documents/10.1016_s0140-6736(19)31388-1/sap.pdf +3 -0
- documents/10.1016_s0140-6736(19)31793-3/sap.pdf +0 -0
- documents/10.1056_nejmoa1513248/protocol.pdf +3 -0
- documents/10.1056_nejmoa1513248/sap.pdf +3 -0
- documents/10.1056_nejmoa1700456/protocol.pdf +3 -0
- documents/10.1056_nejmoa1700456/sap.pdf +3 -0
- documents/10.1056_nejmoa1708131/protocol.pdf +3 -0
- documents/10.1056_nejmoa1708131/sap.pdf +3 -0
- documents/10.1056_nejmoa1708454/protocol.pdf +3 -0
- documents/10.1056_nejmoa1708454/sap.pdf +3 -0
- documents/10.1056_nejmoa1716995/protocol.pdf +3 -0
- documents/10.1056_nejmoa1716995/sap.pdf +3 -0
- documents/10.1056_nejmoa1801601/protocol.pdf +3 -0
- documents/10.1056_nejmoa1801601/sap.pdf +3 -0
- documents/10.1056_nejmoa1805104/protocol.pdf +3 -0
- documents/10.1056_nejmoa1805104/sap.pdf +3 -0
- documents/10.1056_nejmoa1816714/protocol.pdf +3 -0
- documents/10.1056_nejmoa1816714/sap.pdf +3 -0
- documents/10.1056_nejmoa1903869/protocol.pdf +3 -0
- documents/10.1056_nejmoa1908655/protocol.pdf +3 -0
- documents/10.1056_nejmoa1908655/sap.pdf +3 -0
- documents/10.1056_nejmoa1909953/protocol.pdf +3 -0
- documents/10.1056_nejmoa1909953/sap.pdf +3 -0
- documents/10.1200_jco.2017.74.0720/protocol.pdf +3 -0
- documents/10.1200_jco.2017.74.0720/sap.pdf +3 -0
- documents/10.1200_jco.2017.75.6270/protocol.pdf +3 -0
- documents/10.1200_jco.2017.75.6270/sap.pdf +3 -0
- download_docs.py +13 -1
- replace_doc.py +15 -0
.gitattributes
CHANGED
|
@@ -4852,3 +4852,45 @@ documents/10.1056_nejmoa2302312/sap.pdf filter=lfs diff=lfs merge=lfs -text
|
|
| 4852 |
documents/10.1056_nejmoa2116596/sap.pdf filter=lfs diff=lfs merge=lfs -text
|
| 4853 |
documents/10.1016_s0140-6736(24)01498-3/sap.pdf filter=lfs diff=lfs merge=lfs -text
|
| 4854 |
documents/10.1056_nejmoa2210645/protocol.pdf filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4852 |
documents/10.1056_nejmoa2116596/sap.pdf filter=lfs diff=lfs merge=lfs -text
|
| 4853 |
documents/10.1016_s0140-6736(24)01498-3/sap.pdf filter=lfs diff=lfs merge=lfs -text
|
| 4854 |
documents/10.1056_nejmoa2210645/protocol.pdf filter=lfs diff=lfs merge=lfs -text
|
| 4855 |
+
documents/10.1016_s0140-6736(17)33297-x/sap.pdf filter=lfs diff=lfs merge=lfs -text
|
| 4856 |
+
documents/10.1016_s0140-6736(17)33297-x/protocol.pdf filter=lfs diff=lfs merge=lfs -text
|
| 4857 |
+
documents/10.1001_jama.2019.1660/sap.pdf filter=lfs diff=lfs merge=lfs -text
|
| 4858 |
+
documents/10.1001_jama.2019.0071/sap.pdf filter=lfs diff=lfs merge=lfs -text
|
| 4859 |
+
documents/10.1001_jama.2019.1660/protocol.pdf filter=lfs diff=lfs merge=lfs -text
|
| 4860 |
+
documents/10.1016_s0140-6736(18)32321-3/sap.pdf filter=lfs diff=lfs merge=lfs -text
|
| 4861 |
+
documents/10.1016_s0140-6736(18)32321-3/protocol.pdf filter=lfs diff=lfs merge=lfs -text
|
| 4862 |
+
documents/10.1001_jama.2019.0071/protocol.pdf filter=lfs diff=lfs merge=lfs -text
|
| 4863 |
+
documents/10.1056_nejmoa1908655/sap.pdf filter=lfs diff=lfs merge=lfs -text
|
| 4864 |
+
documents/10.1056_nejmoa1908655/protocol.pdf filter=lfs diff=lfs merge=lfs -text
|
| 4865 |
+
documents/10.1056_nejmoa1805104/sap.pdf filter=lfs diff=lfs merge=lfs -text
|
| 4866 |
+
documents/10.1056_nejmoa1816714/sap.pdf filter=lfs diff=lfs merge=lfs -text
|
| 4867 |
+
documents/10.1056_nejmoa1805104/protocol.pdf filter=lfs diff=lfs merge=lfs -text
|
| 4868 |
+
documents/10.1056_nejmoa1816714/protocol.pdf filter=lfs diff=lfs merge=lfs -text
|
| 4869 |
+
documents/10.1200_jco.2017.74.0720/sap.pdf filter=lfs diff=lfs merge=lfs -text
|
| 4870 |
+
documents/10.1200_jco.2017.74.0720/protocol.pdf filter=lfs diff=lfs merge=lfs -text
|
| 4871 |
+
documents/10.1001_jama.2019.0557/sap.pdf filter=lfs diff=lfs merge=lfs -text
|
| 4872 |
+
documents/10.1001_jama.2019.0557/protocol.pdf filter=lfs diff=lfs merge=lfs -text
|
| 4873 |
+
documents/10.1056_nejmoa1801601/sap.pdf filter=lfs diff=lfs merge=lfs -text
|
| 4874 |
+
documents/10.1056_nejmoa1801601/protocol.pdf filter=lfs diff=lfs merge=lfs -text
|
| 4875 |
+
documents/10.1056_nejmoa1513248/sap.pdf filter=lfs diff=lfs merge=lfs -text
|
| 4876 |
+
documents/10.1056_nejmoa1513248/protocol.pdf filter=lfs diff=lfs merge=lfs -text
|
| 4877 |
+
documents/10.1056_nejmoa1700456/sap.pdf filter=lfs diff=lfs merge=lfs -text
|
| 4878 |
+
documents/10.1056_nejmoa1700456/protocol.pdf filter=lfs diff=lfs merge=lfs -text
|
| 4879 |
+
documents/10.1016_s0140-6736(19)31388-1/sap.pdf filter=lfs diff=lfs merge=lfs -text
|
| 4880 |
+
documents/10.1016_s0140-6736(19)31388-1/protocol.pdf filter=lfs diff=lfs merge=lfs -text
|
| 4881 |
+
documents/10.1056_nejmoa1909953/sap.pdf filter=lfs diff=lfs merge=lfs -text
|
| 4882 |
+
documents/10.1001_jama.2019.12618/sap.pdf filter=lfs diff=lfs merge=lfs -text
|
| 4883 |
+
documents/10.1056_nejmoa1708131/sap.pdf filter=lfs diff=lfs merge=lfs -text
|
| 4884 |
+
documents/10.1056_nejmoa1909953/protocol.pdf filter=lfs diff=lfs merge=lfs -text
|
| 4885 |
+
documents/10.1001_jama.2019.12618/protocol.pdf filter=lfs diff=lfs merge=lfs -text
|
| 4886 |
+
documents/10.1200_jco.2017.75.6270/sap.pdf filter=lfs diff=lfs merge=lfs -text
|
| 4887 |
+
documents/10.1056_nejmoa1708131/protocol.pdf filter=lfs diff=lfs merge=lfs -text
|
| 4888 |
+
documents/10.1056_nejmoa1716995/sap.pdf filter=lfs diff=lfs merge=lfs -text
|
| 4889 |
+
documents/10.1056_nejmoa1716995/protocol.pdf filter=lfs diff=lfs merge=lfs -text
|
| 4890 |
+
documents/10.1200_jco.2017.75.6270/protocol.pdf filter=lfs diff=lfs merge=lfs -text
|
| 4891 |
+
documents/10.1056_nejmoa1708454/protocol.pdf filter=lfs diff=lfs merge=lfs -text
|
| 4892 |
+
documents/10.1016_s0140-6736(19)30772-x/sap.pdf filter=lfs diff=lfs merge=lfs -text
|
| 4893 |
+
documents/10.1016_s0140-6736(19)30772-x/protocol.pdf filter=lfs diff=lfs merge=lfs -text
|
| 4894 |
+
documents/10.1056_nejmoa1708454/sap.pdf filter=lfs diff=lfs merge=lfs -text
|
| 4895 |
+
documents/10.1056_nejmoa1903869/protocol.pdf filter=lfs diff=lfs merge=lfs -text
|
| 4896 |
+
documents/10.1016_s0140-6736(19)31150-x/protocol.pdf filter=lfs diff=lfs merge=lfs -text
|
SYNC_README.md
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Sync Dataset
|
| 2 |
+
|
| 3 |
+
`sync_dataset.py` pulls the latest rows from the master Google Sheet, downloads the protocol/SAP PDFs for any new rows, and pushes everything to the Hugging Face dataset at [`trialdesignbench/source`](https://huggingface.co/datasets/trialdesignbench/source).
|
| 4 |
+
|
| 5 |
+
## What it does
|
| 6 |
+
|
| 7 |
+
1. Downloads the Google Sheet as CSV, converts to Parquet → overwrites `data/tdr.parquet`.
|
| 8 |
+
2. Diffs against the previous `tdr.parquet` by the `#` column to find new rows.
|
| 9 |
+
3. For each new row, downloads:
|
| 10 |
+
- `Study Protocol Link` → `documents/<#>/protocol.pdf`
|
| 11 |
+
- `Protocol+SAP / SAP Link` → `documents/<#>/sap.pdf`
|
| 12 |
+
- Skips empty links. Skips files already on disk. Writes a `*.error.txt` on failure.
|
| 13 |
+
4. Uploads the updated `tdr.parquet` and any new PDFs to Hugging Face.
|
| 14 |
+
|
| 15 |
+
## One-time setup
|
| 16 |
+
|
| 17 |
+
```bash
|
| 18 |
+
# 1. Python deps
|
| 19 |
+
pip install -U "huggingface_hub[cli]" pandas pyarrow openpyxl
|
| 20 |
+
# pandas + pyarrow are required for the Parquet read/write.
|
| 21 |
+
# openpyxl is only needed if the source file is an uploaded .xlsx
|
| 22 |
+
# (htmlview URL) rather than a native Google Sheet.
|
| 23 |
+
|
| 24 |
+
# 2. Authenticate to Hugging Face (write token from https://huggingface.co/settings/tokens)
|
| 25 |
+
hf auth login
|
| 26 |
+
|
| 27 |
+
# 3. Make sure the Google Sheet is shared as "Anyone with the link: Viewer"
|
| 28 |
+
# Sheet URL: https://docs.google.com/spreadsheets/d/1Vb6U9Jzigtg5hLcn4R_5REW_G84cNVk6
|
| 29 |
+
```
|
| 30 |
+
|
| 31 |
+
## Usage
|
| 32 |
+
|
| 33 |
+
Run from the `source/` directory:
|
| 34 |
+
|
| 35 |
+
```bash
|
| 36 |
+
cd /Users/tengjun2/Desktop/clinical/tdb/source
|
| 37 |
+
|
| 38 |
+
# Preview new rows without changing anything
|
| 39 |
+
python3 sync_dataset.py --dry-run
|
| 40 |
+
|
| 41 |
+
# Download new PDFs and update tdr.parquet locally, but don't upload
|
| 42 |
+
python3 sync_dataset.py --no-upload
|
| 43 |
+
|
| 44 |
+
# Full sync: fetch sheet, download new PDFs, upload to Hugging Face
|
| 45 |
+
python3 sync_dataset.py
|
| 46 |
+
```
|
| 47 |
+
|
| 48 |
+
## Output layout
|
| 49 |
+
|
| 50 |
+
```
|
| 51 |
+
source/
|
| 52 |
+
├── data/
|
| 53 |
+
│ └── tdr.parquet # latest sheet content (snappy-compressed)
|
| 54 |
+
├── documents/
|
| 55 |
+
│ └── <row_#>/
|
| 56 |
+
│ ├── protocol.pdf
|
| 57 |
+
│ ├── sap.pdf
|
| 58 |
+
│ ├── protocol.error.txt # only present on download failure
|
| 59 |
+
│ └── sap.error.txt
|
| 60 |
+
└── sync_dataset.py
|
| 61 |
+
```
|
| 62 |
+
|
| 63 |
+
## Configuration
|
| 64 |
+
|
| 65 |
+
Edit constants at the top of `sync_dataset.py` if any of these change:
|
| 66 |
+
|
| 67 |
+
| Variable | Default | Meaning |
|
| 68 |
+
| ------------ | -------------------------------------------------- | ---------------------------------------- |
|
| 69 |
+
| `SHEET_ID` | `1Vb6U9Jzigtg5hLcn4R_5REW_G84cNVk6` | Google Sheet document ID |
|
| 70 |
+
| `SHEET_GID` | `0` | Sheet tab GID (find it in the sheet URL) |
|
| 71 |
+
| `HF_REPO` | `trialdesignbench/source` | Hugging Face dataset repo |
|
| 72 |
+
| `PARQUET_PATH` | `data/tdr.parquet` | Local Parquet path |
|
| 73 |
+
| `DOCS_DIR` | `documents/` | PDF output root |
|
| 74 |
+
|
| 75 |
+
## Troubleshooting
|
| 76 |
+
|
| 77 |
+
**"Google Sheet is not publicly shared"** — Open the sheet → Share → General access → "Anyone with the link" → Viewer.
|
| 78 |
+
|
| 79 |
+
**A PDF row writes `*.error.txt`** — The source server rejected the request (often `HTTP 403` on paywalled publisher links like NEJM). The row stays in `tdr.parquet`; only the PDF is missing. Re-running won't retry automatically — delete the `.error.txt` and the partial file, then re-run, if you want to retry.
|
| 80 |
+
|
| 81 |
+
**Upload is slow** — Throughput is bounded by your upstream bandwidth. For small incremental syncs (a handful of new files) `hf upload` is used per file. For > 200 new files the script falls back to `hf upload-large-folder` which parallelizes and is resumable.
|
| 82 |
+
|
| 83 |
+
**Diff missed a row whose `#` was reused** — The script keys on the `#` column. If a row's content changed without `#` changing, it won't be detected as new. Inspect manually in that case.
|
| 84 |
+
|
| 85 |
+
## Notes
|
| 86 |
+
|
| 87 |
+
- The script only **adds** new rows. Rows deleted from the sheet are kept in the local Parquet file and on Hugging Face — clean those up by hand if needed.
|
| 88 |
+
- `tdr.parquet` is always overwritten with the latest sheet content, so edits in the sheet (typo fixes, etc.) propagate.
|
| 89 |
+
- PDFs are never re-downloaded if already present. Force a re-download by deleting the file.
|
__pycache__/sync_dataset.cpython-313.pyc
ADDED
|
Binary file (14.2 kB). View file
|
|
|
delete_old_folders.py
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Delete the old numeric-named documents/<#>/ folders from the HF dataset."""
|
| 2 |
+
|
| 3 |
+
from __future__ import annotations
|
| 4 |
+
|
| 5 |
+
from huggingface_hub import HfApi
|
| 6 |
+
|
| 7 |
+
REPO = "trialdesignbench/source"
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
def main() -> None:
|
| 11 |
+
api = HfApi()
|
| 12 |
+
files = api.list_repo_files(REPO, repo_type="dataset")
|
| 13 |
+
|
| 14 |
+
old = [
|
| 15 |
+
f for f in files
|
| 16 |
+
if f.startswith("documents/")
|
| 17 |
+
and len(f.split("/")) >= 2
|
| 18 |
+
and f.split("/")[1].isdigit()
|
| 19 |
+
]
|
| 20 |
+
print(f"Found {len(old)} files under numeric folders. First 5:")
|
| 21 |
+
for p in old[:5]:
|
| 22 |
+
print(" ", p)
|
| 23 |
+
|
| 24 |
+
if not old:
|
| 25 |
+
return
|
| 26 |
+
|
| 27 |
+
confirm = input(f"Delete all {len(old)} files? [y/N] ").strip().lower()
|
| 28 |
+
if confirm != "y":
|
| 29 |
+
print("Aborted.")
|
| 30 |
+
return
|
| 31 |
+
|
| 32 |
+
api.delete_files(
|
| 33 |
+
delete_patterns=old,
|
| 34 |
+
repo_id=REPO,
|
| 35 |
+
repo_type="dataset",
|
| 36 |
+
commit_message="Remove old numeric-named document folders",
|
| 37 |
+
)
|
| 38 |
+
print("Deleted.")
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
if __name__ == "__main__":
|
| 42 |
+
main()
|
documents/10.1001_jama.2018.20579/sap.pdf
ADDED
|
Binary file (100 kB). View file
|
|
|
documents/10.1001_jama.2019.0071/protocol.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5dfe5a197820387b23f1d4570a4a1519321918afbc21f3fa5bd8a27a9cb04cc0
|
| 3 |
+
size 2754354
|
documents/10.1001_jama.2019.0071/sap.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:6fd76358b47d339576b018881d70bada62c38e20b8a01c21e5686453ffadf4a4
|
| 3 |
+
size 281032
|
documents/10.1001_jama.2019.0557/protocol.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:08f104e10f8ca44d048262aab02bf11f63f0b59cae9d55f5fae8ff670ce79f27
|
| 3 |
+
size 1209003
|
documents/10.1001_jama.2019.0557/sap.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:08f104e10f8ca44d048262aab02bf11f63f0b59cae9d55f5fae8ff670ce79f27
|
| 3 |
+
size 1209003
|
documents/10.1001_jama.2019.12618/protocol.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b7e0d9fff5fb3b8681a408213bc82810107ea8689d4e2a7f0c5ddd060fc98193
|
| 3 |
+
size 9456599
|
documents/10.1001_jama.2019.12618/sap.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b7e0d9fff5fb3b8681a408213bc82810107ea8689d4e2a7f0c5ddd060fc98193
|
| 3 |
+
size 9456599
|
documents/10.1001_jama.2019.1660/protocol.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:96abe28b22bfb56939c150fc143d024d306d81fca255f54550ce8cb194e2f5cc
|
| 3 |
+
size 1215290
|
documents/10.1001_jama.2019.1660/sap.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1f9ba880010ccd6a2581715b5824c4759f437337d36372bf800b4c307245b549
|
| 3 |
+
size 408047
|
documents/10.1016_s0140-6736(17)33297-x/protocol.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9f64a224e34e8b1ccab7161b025b8944ff05f0e06e15c4ba70d14b1713daccb3
|
| 3 |
+
size 2491616
|
documents/10.1016_s0140-6736(17)33297-x/sap.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9f64a224e34e8b1ccab7161b025b8944ff05f0e06e15c4ba70d14b1713daccb3
|
| 3 |
+
size 2491616
|
documents/10.1016_s0140-6736(18)32321-3/protocol.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:6f0c1405283c72390c92ca645b3f62502b18ba7b7aebd59ea6bf3f25e5e51395
|
| 3 |
+
size 1079157
|
documents/10.1016_s0140-6736(18)32321-3/sap.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:6f0c1405283c72390c92ca645b3f62502b18ba7b7aebd59ea6bf3f25e5e51395
|
| 3 |
+
size 1079157
|
documents/10.1016_s0140-6736(19)30772-x/protocol.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0098f38b6a5831341ce5f5ef1a8a2b27bebed3c5fee846ca099bb6ce690457ce
|
| 3 |
+
size 2004321
|
documents/10.1016_s0140-6736(19)30772-x/sap.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:6f9d0f965bc28eafc1229d293318c6ab1b57112f55411ad092bbeb147b082a41
|
| 3 |
+
size 795974
|
documents/10.1016_s0140-6736(19)31150-x/protocol.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2c379993f99707de410d645765a4282e966085eef5379847d029c6c592884c40
|
| 3 |
+
size 918504
|
documents/10.1016_s0140-6736(19)31388-1/protocol.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:247060db1ac1a71eb649698297fde5ecf50dd927249822c001dafda788b95545
|
| 3 |
+
size 1446328
|
documents/10.1016_s0140-6736(19)31388-1/sap.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e0444958cf55da7f5d82d21ffc0809f728a7b77707d32c9a1257ac75e8c2f676
|
| 3 |
+
size 1054189
|
documents/10.1016_s0140-6736(19)31793-3/sap.pdf
ADDED
|
Binary file (51 kB). View file
|
|
|
documents/10.1056_nejmoa1513248/protocol.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e8d22817a7019ded0b8998c9d8578e444ec91af75355592108b5a6b72f10cbc3
|
| 3 |
+
size 872936
|
documents/10.1056_nejmoa1513248/sap.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:6a646ff761268b9cc00b6762529f91d4ea93c7b39af5e4f2b152b46f52a2d47b
|
| 3 |
+
size 672972
|
documents/10.1056_nejmoa1700456/protocol.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:37a4853dffc6a551580d6c14b40179c8ee8bff8fbbcd2f2280ebd9c9a253941b
|
| 3 |
+
size 13460546
|
documents/10.1056_nejmoa1700456/sap.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:37a4853dffc6a551580d6c14b40179c8ee8bff8fbbcd2f2280ebd9c9a253941b
|
| 3 |
+
size 13460546
|
documents/10.1056_nejmoa1708131/protocol.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:764d9df5bee793e75b0251679b8585674b4913dd21ac4042210a14039537e194
|
| 3 |
+
size 4316285
|
documents/10.1056_nejmoa1708131/sap.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0aecd4b62ebda8a34ea4d8aebf0b3f689336f4205d02351c1a3fa892d5c8571d
|
| 3 |
+
size 260398
|
documents/10.1056_nejmoa1708454/protocol.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:94d6d58fa1594954193d172da6b1ffc948b83decef55edcd9cf7e99a0ae91181
|
| 3 |
+
size 1202771
|
documents/10.1056_nejmoa1708454/sap.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:02d15b9ea9d1a4913484e553801be2ca633ff02031f0be63d946a6d54c0915a1
|
| 3 |
+
size 4557136
|
documents/10.1056_nejmoa1716995/protocol.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:486a7c300a9a3c8a8a4d027f1d8bff151722e715d762c406230b32dcbd7c5aa5
|
| 3 |
+
size 1195199
|
documents/10.1056_nejmoa1716995/sap.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f94679ff396d4becff0380b0c9b6977cf633d4a0167244355d4d29009afbde84
|
| 3 |
+
size 851897
|
documents/10.1056_nejmoa1801601/protocol.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d270558bb30306f8d965f5826d3debf14d087261934ecc74516e39b973332880
|
| 3 |
+
size 1080077
|
documents/10.1056_nejmoa1801601/sap.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:6b3276071d3ebd13e65f2d04b0d6bb3e4e9539963a6437d86bcc3aac6353a57f
|
| 3 |
+
size 166155
|
documents/10.1056_nejmoa1805104/protocol.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d9ba3470bc0bb95641699f1fe08359ec229d72d25999738bee206c49f1be4005
|
| 3 |
+
size 6501069
|
documents/10.1056_nejmoa1805104/sap.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d9ba3470bc0bb95641699f1fe08359ec229d72d25999738bee206c49f1be4005
|
| 3 |
+
size 6501069
|
documents/10.1056_nejmoa1816714/protocol.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:14496801a4397f97ced0c949623550da93a5d8cb9a17982b9a8791cecce64915
|
| 3 |
+
size 2578319
|
documents/10.1056_nejmoa1816714/sap.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:14496801a4397f97ced0c949623550da93a5d8cb9a17982b9a8791cecce64915
|
| 3 |
+
size 2578319
|
documents/10.1056_nejmoa1903869/protocol.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a765ac16832c3638653c44c89cf033d8a5a55b80855af0818378e9bc9e2212fd
|
| 3 |
+
size 2184520
|
documents/10.1056_nejmoa1908655/protocol.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c645095faa926776d2f9f9f564dd348d44e348d4c3105d36a20276d33ea904b7
|
| 3 |
+
size 1231466
|
documents/10.1056_nejmoa1908655/sap.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5590f7a09d944d30e6b5f31b78fa67e8982fda1c92d9eaedbca87c025b2bdb0f
|
| 3 |
+
size 601155
|
documents/10.1056_nejmoa1909953/protocol.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9d4fe3f2632832fb7695159422d10aff7a4df6d841777fe34bd644abd4e787ae
|
| 3 |
+
size 2297612
|
documents/10.1056_nejmoa1909953/sap.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:fd81a8db29ff12599057679d1c59345d81c5455387385b65a310a7a006203315
|
| 3 |
+
size 562980
|
documents/10.1200_jco.2017.74.0720/protocol.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:511f2be5a0dde243fa66512139c1029e0a6032db84c4fbc5cecbed7a99f887a6
|
| 3 |
+
size 478930
|
documents/10.1200_jco.2017.74.0720/sap.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:003097bc03e2266b9476c5c48d1064e0b24809fa7c8019855358a13a26c2795a
|
| 3 |
+
size 359491
|
documents/10.1200_jco.2017.75.6270/protocol.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a312bf6befdd59bcaf8edbce725b215636d075fb52437c59286a2c1e4a3f2ffa
|
| 3 |
+
size 3378050
|
documents/10.1200_jco.2017.75.6270/sap.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a312bf6befdd59bcaf8edbce725b215636d075fb52437c59286a2c1e4a3f2ffa
|
| 3 |
+
size 3378050
|
download_docs.py
CHANGED
|
@@ -12,6 +12,7 @@ import time
|
|
| 12 |
import urllib.error
|
| 13 |
import urllib.request
|
| 14 |
from pathlib import Path
|
|
|
|
| 15 |
|
| 16 |
CSV_PATH = Path(__file__).parent / "file.csv"
|
| 17 |
OUT_ROOT = Path(__file__).parent / "downloads"
|
|
@@ -25,6 +26,12 @@ UA = (
|
|
| 25 |
)
|
| 26 |
|
| 27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
def download(url: str, dest: Path) -> tuple[bool, str]:
|
| 29 |
if dest.exists() and dest.stat().st_size > 0:
|
| 30 |
return True, "exists"
|
|
@@ -64,7 +71,12 @@ def main(start_row: int = 3) -> None:
|
|
| 64 |
print(f"[{num}] skip: no links")
|
| 65 |
continue
|
| 66 |
|
| 67 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 68 |
row_dir.mkdir(exist_ok=True)
|
| 69 |
|
| 70 |
if protocol:
|
|
|
|
| 12 |
import urllib.error
|
| 13 |
import urllib.request
|
| 14 |
from pathlib import Path
|
| 15 |
+
from urllib.parse import urlparse
|
| 16 |
|
| 17 |
CSV_PATH = Path(__file__).parent / "file.csv"
|
| 18 |
OUT_ROOT = Path(__file__).parent / "downloads"
|
|
|
|
| 26 |
)
|
| 27 |
|
| 28 |
|
| 29 |
+
def paper_link_slug(link: str) -> str:
|
| 30 |
+
path = urlparse((link or "").strip()).path.strip("/")
|
| 31 |
+
parts = [p for p in path.split("/") if p]
|
| 32 |
+
return "_".join(parts[-2:]) if len(parts) >= 2 else ""
|
| 33 |
+
|
| 34 |
+
|
| 35 |
def download(url: str, dest: Path) -> tuple[bool, str]:
|
| 36 |
if dest.exists() and dest.stat().st_size > 0:
|
| 37 |
return True, "exists"
|
|
|
|
| 71 |
print(f"[{num}] skip: no links")
|
| 72 |
continue
|
| 73 |
|
| 74 |
+
slug = paper_link_slug(row.get("Paper Link") or "")
|
| 75 |
+
if not slug:
|
| 76 |
+
print(f"[{num}] skip: no usable Paper Link")
|
| 77 |
+
continue
|
| 78 |
+
|
| 79 |
+
row_dir = OUT_ROOT / slug
|
| 80 |
row_dir.mkdir(exist_ok=True)
|
| 81 |
|
| 82 |
if protocol:
|
replace_doc.py
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from huggingface_hub import HfApi
|
| 2 |
+
|
| 3 |
+
api = HfApi()
|
| 4 |
+
# api.delete_folder(
|
| 5 |
+
# "documents",
|
| 6 |
+
# repo_id="trialdesignbench/source",
|
| 7 |
+
# repo_type="dataset",
|
| 8 |
+
# )
|
| 9 |
+
api.upload_large_folder(
|
| 10 |
+
folder_path="/users/teng77/source", # parent — preserves "documents/" prefix
|
| 11 |
+
repo_id="trialdesignbench/source",
|
| 12 |
+
repo_type="dataset",
|
| 13 |
+
allow_patterns=["documents/**"],
|
| 14 |
+
ignore_patterns=[".cache/**", "**/.cache/**"],
|
| 15 |
+
)
|