Upload 5 files
Browse files- .gitattributes +3 -0
- README.md +164 -0
- procesar_uchile.py +51 -0
- tesis.uchile.jsonl +3 -0
- tesis_uchile_min.json +3 -0
- tesis_uchile_pretty.json +3 -0
.gitattributes
CHANGED
|
@@ -59,3 +59,6 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 59 |
*.webm filter=lfs diff=lfs merge=lfs -text
|
| 60 |
metadata.csv filter=lfs diff=lfs merge=lfs -text
|
| 61 |
train.csv filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
*.webm filter=lfs diff=lfs merge=lfs -text
|
| 60 |
metadata.csv filter=lfs diff=lfs merge=lfs -text
|
| 61 |
train.csv filter=lfs diff=lfs merge=lfs -text
|
| 62 |
+
tesis_uchile_min.json filter=lfs diff=lfs merge=lfs -text
|
| 63 |
+
tesis_uchile_pretty.json filter=lfs diff=lfs merge=lfs -text
|
| 64 |
+
tesis.uchile.jsonl filter=lfs diff=lfs merge=lfs -text
|
README.md
CHANGED
|
@@ -1,3 +1,167 @@
|
|
| 1 |
---
|
|
|
|
| 2 |
license: unknown
|
| 3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
pretty_name: Tesis UChile
|
| 3 |
license: unknown
|
| 4 |
---
|
| 5 |
+
|
| 6 |
+
# Tesis UChile
|
| 7 |
+
|
| 8 |
+
`erickfmm/Tesis_UChile` is a collection of thesis metadata from the University of Chile repository (`repositorio.uchile.cl`). The data was obtained by scraping public pages around August 2024 (approximately), and then normalized into a row-based CSV plus grouped JSON exports.
|
| 9 |
+
|
| 10 |
+
## What is in this dataset?
|
| 11 |
+
|
| 12 |
+
The main file is `train.csv`. Each row represents one metadata value associated with a source record. Rows are linked by the `origen` field, which acts as the record identifier or source URL.
|
| 13 |
+
|
| 14 |
+
The repository also includes JSON and JSONL exports generated from `train.csv`, where all rows that share the same `origen` are grouped into a single document.
|
| 15 |
+
|
| 16 |
+
This dataset mainly contains bibliographic and repository metadata, for example:
|
| 17 |
+
|
| 18 |
+
- thesis title
|
| 19 |
+
- author
|
| 20 |
+
- advisor
|
| 21 |
+
- publisher / faculty / school
|
| 22 |
+
- issue or accession dates
|
| 23 |
+
- language
|
| 24 |
+
- subjects
|
| 25 |
+
- rights / access fields
|
| 26 |
+
- repository links and file links
|
| 27 |
+
|
| 28 |
+
Most keys follow Dublin Core naming conventions such as `dc.title`, `dc.subject`, `dc.identifier.uri`, and `dcterms.accessRights`.
|
| 29 |
+
|
| 30 |
+
## Files
|
| 31 |
+
|
| 32 |
+
| File | Description | Link |
|
| 33 |
+
| --- | --- | --- |
|
| 34 |
+
| `train.csv` | Row-level metadata table used as the base dataset. On Hugging Face, this is exposed as the `train` split. | [Download](https://huggingface.co/datasets/erickfmm/Tesis_UChile/resolve/main/train.csv) |
|
| 35 |
+
| `tesis_uchile_pretty.json` | Grouped JSON array, pretty-printed for easier inspection. | [Download](https://huggingface.co/datasets/erickfmm/Tesis_UChile/resolve/main/tesis_uchile_pretty.json) |
|
| 36 |
+
| `tesis_uchile_min.json` | Grouped JSON array, compact version of the same data. | [Download](https://huggingface.co/datasets/erickfmm/Tesis_UChile/resolve/main/tesis_uchile_min.json) |
|
| 37 |
+
| `tesis.uchile.jsonl` | Grouped JSON Lines export, one record per line, convenient for streaming and incremental processing. | [Download](https://huggingface.co/datasets/erickfmm/Tesis_UChile/resolve/main/tesis.uchile.jsonl) |
|
| 38 |
+
|
| 39 |
+
## CSV schema
|
| 40 |
+
|
| 41 |
+
The processing script expects at least the following columns in `train.csv`:
|
| 42 |
+
|
| 43 |
+
| Column | Meaning |
|
| 44 |
+
| --- | --- |
|
| 45 |
+
| `origen` | Source identifier for a thesis record, typically the repository URL used to group rows. |
|
| 46 |
+
| `DC` | Metadata field name, usually a Dublin Core-style key such as `dc.title` or `dc.subject`. |
|
| 47 |
+
| `nombre` | Original scraped field name. A special case maps `filelink` to `extra.file.link` when `DC` is missing. |
|
| 48 |
+
| `value` | Metadata value. Empty values are skipped when building the JSON exports. |
|
| 49 |
+
| `lang` | Optional language tag for the value, for example `es_CL`. |
|
| 50 |
+
|
| 51 |
+
## JSON / JSONL structure
|
| 52 |
+
|
| 53 |
+
The JSON exports are built by grouping all rows with the same `origen`.
|
| 54 |
+
|
| 55 |
+
Rules used in the export:
|
| 56 |
+
|
| 57 |
+
- each grouped record gets `_id = origen`
|
| 58 |
+
- scalar values are stored as `{"value": "..."}`
|
| 59 |
+
- when a language is available, values become `{"value": "...", "lang": "..."}`
|
| 60 |
+
- repeated metadata fields become lists
|
| 61 |
+
- if `DC` is missing and `nombre == "filelink"`, the field is stored as `extra.file.link`
|
| 62 |
+
|
| 63 |
+
Example grouped record:
|
| 64 |
+
|
| 65 |
+
```json
|
| 66 |
+
{
|
| 67 |
+
"_id": "https://repositorio.uchile.cl/handle/2250/100054",
|
| 68 |
+
"dc.contributor.advisor": {
|
| 69 |
+
"value": "Cárdenas, Juan",
|
| 70 |
+
"lang": "es_CL"
|
| 71 |
+
},
|
| 72 |
+
"dc.contributor.author": {
|
| 73 |
+
"value": "Gallego, Francisco",
|
| 74 |
+
"lang": "es_CL"
|
| 75 |
+
},
|
| 76 |
+
"dc.contributor.editor": [
|
| 77 |
+
{
|
| 78 |
+
"value": "Facultad de Arquitectura y Urbanismo",
|
| 79 |
+
"lang": "es_CL"
|
| 80 |
+
},
|
| 81 |
+
{
|
| 82 |
+
"value": "Escuela de Arquitectura",
|
| 83 |
+
"lang": "es_CL"
|
| 84 |
+
}
|
| 85 |
+
],
|
| 86 |
+
"dc.identifier.uri": {
|
| 87 |
+
"value": "https://repositorio.uchile.cl/handle/2250/100054"
|
| 88 |
+
},
|
| 89 |
+
"extra.file.link": {
|
| 90 |
+
"value": "..."
|
| 91 |
+
}
|
| 92 |
+
}
|
| 93 |
+
```
|
| 94 |
+
|
| 95 |
+
## Example code
|
| 96 |
+
|
| 97 |
+
### Load the CSV with pandas
|
| 98 |
+
|
| 99 |
+
```python
|
| 100 |
+
import pandas as pd
|
| 101 |
+
|
| 102 |
+
df = pd.read_csv(
|
| 103 |
+
"hf://datasets/erickfmm/Tesis_UChile/train.csv",
|
| 104 |
+
encoding="utf-8",
|
| 105 |
+
)
|
| 106 |
+
|
| 107 |
+
print(df.head())
|
| 108 |
+
print(df.columns.tolist())
|
| 109 |
+
```
|
| 110 |
+
|
| 111 |
+
### Load the dataset with `datasets`
|
| 112 |
+
|
| 113 |
+
```python
|
| 114 |
+
from datasets import load_dataset
|
| 115 |
+
|
| 116 |
+
dataset = load_dataset("erickfmm/Tesis_UChile")
|
| 117 |
+
print(dataset)
|
| 118 |
+
print(dataset["train"][0])
|
| 119 |
+
```
|
| 120 |
+
|
| 121 |
+
### Stream the JSONL export
|
| 122 |
+
|
| 123 |
+
```python
|
| 124 |
+
import json
|
| 125 |
+
import urllib.request
|
| 126 |
+
|
| 127 |
+
url = "https://huggingface.co/datasets/erickfmm/Tesis_UChile/resolve/main/tesis.uchile.jsonl"
|
| 128 |
+
|
| 129 |
+
with urllib.request.urlopen(url) as response:
|
| 130 |
+
for i, line in enumerate(response):
|
| 131 |
+
record = json.loads(line)
|
| 132 |
+
title = record.get("dc.title", {})
|
| 133 |
+
print(record["_id"], title)
|
| 134 |
+
if i == 2:
|
| 135 |
+
break
|
| 136 |
+
```
|
| 137 |
+
|
| 138 |
+
### Read the compact JSON export locally
|
| 139 |
+
|
| 140 |
+
```python
|
| 141 |
+
import json
|
| 142 |
+
|
| 143 |
+
with open("tesis_uchile_min.json", "r", encoding="utf-8") as fh:
|
| 144 |
+
data = json.load(fh)
|
| 145 |
+
|
| 146 |
+
print(len(data))
|
| 147 |
+
print(data[0]["_id"])
|
| 148 |
+
```
|
| 149 |
+
|
| 150 |
+
## Source and collection notes
|
| 151 |
+
|
| 152 |
+
- Source website: public pages from the University of Chile repository (`repositorio.uchile.cl`)
|
| 153 |
+
- Collection method: scraping
|
| 154 |
+
- Collection period: around August 2024 (approximate)
|
| 155 |
+
- Contents: public metadata records and derived grouped exports
|
| 156 |
+
|
| 157 |
+
## License
|
| 158 |
+
|
| 159 |
+
No license is provided for this dataset in this repository, or the license is unknown.
|
| 160 |
+
|
| 161 |
+
If you plan to reuse the data, especially beyond research or indexing purposes, please verify the terms of use of the original source and the rights associated with individual records.
|
| 162 |
+
|
| 163 |
+
## Limitations
|
| 164 |
+
|
| 165 |
+
- scraped metadata can contain inconsistencies, missing fields, duplicates, or formatting issues
|
| 166 |
+
- language tags are not guaranteed to exist for every value
|
| 167 |
+
- the JSON exports are derived from `train.csv`, so updates to the CSV should be regenerated in the exported formats
|
procesar_uchile.py
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import pandas as pd
|
| 2 |
+
|
| 3 |
+
print("cargar data")
|
| 4 |
+
# Login using e.g. `huggingface-cli login` to access this dataset
|
| 5 |
+
df = pd.read_csv("hf://datasets/erickfmm/Tesis_UChile/train.csv", encoding="utf-8")
|
| 6 |
+
print("data cargada")
|
| 7 |
+
|
| 8 |
+
final_data = {}
|
| 9 |
+
total = len(df)
|
| 10 |
+
for idx, row in df.iterrows():
|
| 11 |
+
#print(idx, row)
|
| 12 |
+
final_data[row["origen"]] = {"_id": row["origen"]} if row["origen"] not in final_data else final_data[row["origen"]]
|
| 13 |
+
|
| 14 |
+
valor = row["value"] if not pd.isna(row["value"]) or row["value"] is not None else None
|
| 15 |
+
if valor is None:
|
| 16 |
+
continue
|
| 17 |
+
lang = row["lang"] if not pd.isna(row["lang"]) else None
|
| 18 |
+
valor = {"value": valor}
|
| 19 |
+
if lang is not None:
|
| 20 |
+
valor["lang"] = lang
|
| 21 |
+
|
| 22 |
+
if pd.isna(row["DC"]) and row["nombre"] == "filelink":
|
| 23 |
+
row["DC"] = "extra.file.link"
|
| 24 |
+
|
| 25 |
+
if row["DC"] not in final_data[row["origen"]]:
|
| 26 |
+
final_data[row["origen"]][row["DC"]] = valor
|
| 27 |
+
else:
|
| 28 |
+
if type(final_data[row["origen"]][row["DC"]]) is list:
|
| 29 |
+
final_data[row["origen"]][row["DC"]].append(valor)
|
| 30 |
+
else:
|
| 31 |
+
final_data[row["origen"]][row["DC"]] = [final_data[row["origen"]][row["DC"]], valor]
|
| 32 |
+
if idx % 10000 == 0:
|
| 33 |
+
print("procesados ", idx)
|
| 34 |
+
print(idx/float(total)*100.0, "%")
|
| 35 |
+
|
| 36 |
+
#import pprint
|
| 37 |
+
#pprint.pprint(final_data, indent=2)
|
| 38 |
+
|
| 39 |
+
import json
|
| 40 |
+
#print(json.dumps(final_data, indent=2))
|
| 41 |
+
print("save pretty")
|
| 42 |
+
json.dump([final_data[idx] for idx in final_data.keys()], open("tesis_uchile_pretty.json", "w", encoding="utf-8"), indent=2, ensure_ascii=False)
|
| 43 |
+
print("save min")
|
| 44 |
+
json.dump([final_data[idx] for idx in final_data.keys()], open("tesis_uchile_min.json", "w", encoding="utf-8"), ensure_ascii=False)
|
| 45 |
+
|
| 46 |
+
print("save jsonl")
|
| 47 |
+
with open("tesis.uchile.jsonl", "w", encoding="utf-8") as fh:
|
| 48 |
+
for idx in final_data.keys():
|
| 49 |
+
json.dump(final_data[idx], fh, ensure_ascii=False)
|
| 50 |
+
fh.write("\n")
|
| 51 |
+
fh.flush()
|
tesis.uchile.jsonl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:21a068efada8a1533a096c260510509792a1b7c83f4da19eb17dd09a19830ded
|
| 3 |
+
size 185868274
|
tesis_uchile_min.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b0341072729d6e2b388fac8aa45f64431a8acbb37840f87c548bea3bfa296b6b
|
| 3 |
+
size 185868274
|
tesis_uchile_pretty.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:6db6f34d6a08bb8ad0da4e4d2d9c2dc3776dea0a49ee0f322830dac87fe8a4d7
|
| 3 |
+
size 217584687
|