Skip to content

Commit 2473451

Browse files
committed
first commit
0 parents  commit 2473451

19 files changed

Lines changed: 1700 additions & 0 deletions

.env.example

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Wikidata User-Agent (Required by Wikidata API policy)
2+
WIKIDATA_USER_AGENT=open-cinema-index (your-email@example.com)
3+
4+
# TMDb API Key (Required for fetching posters and other metadata from TMDb)
5+
TMDB_API_KEY=your_tmdb_api_key_here
6+

.github/workflows/lint.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Lint
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
pull_request:
7+
branches: [ "main" ]
8+
9+
jobs:
10+
ruff:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
- name: Install ruff
15+
run: pip install ruff
16+
- name: Run Ruff
17+
run: ruff check .

.github/workflows/pytest.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Pytest
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
pull_request:
7+
branches: [ "main" ]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v4
15+
- name: Set up Python 3.10
16+
uses: actions/setup-python@v5
17+
with:
18+
python-version: "3.10"
19+
- name: Install dependencies
20+
run: |
21+
python -m pip install --upgrade pip
22+
pip install .[dev]
23+
- name: Run pytest
24+
run: |
25+
pytest

.gitignore

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Database
2+
data/open_cinema_index.db
3+
4+
# Environments
5+
.env
6+
.venv
7+
env/
8+
venv/
9+
ENV/
10+
env.bak/
11+
venv.bak/
12+
13+
# Python
14+
__pycache__/
15+
*.py[cod]
16+
*$py.class
17+
18+
# IDEs
19+
.idea/
20+
.vscode/
21+
22+
# Distribution / packaging
23+
dist/
24+
build/
25+
*.egg-info/

DEVELOPMENT.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# Development Guide
2+
3+
This document provides information for developers who want to contribute to the `open-cinema-index` project.
4+
5+
## Getting Started
6+
7+
### Prerequisites
8+
9+
- Python 3.10+
10+
- `pip`
11+
12+
### Installation
13+
14+
1. Clone the repository:
15+
```bash
16+
git clone https://github.com/project-watchlist/open-cinema-index.git
17+
cd open-cinema-index
18+
```
19+
20+
2. Install dependencies:
21+
```bash
22+
pip install -e .
23+
```
24+
25+
3. Set up environment variables as described in the `README.md`.
26+
27+
## Database Migrations
28+
29+
This project uses [Alembic](https://alembic.sqlalchemy.org/) for database migrations. The database is a SQLite file located at `data/open_cinema_index.db`.
30+
31+
### Running Migrations
32+
33+
To bring your local database up to date with the latest schema, run:
34+
35+
```bash
36+
alembic upgrade head
37+
```
38+
39+
### Creating New Migrations
40+
41+
If you make changes to the models in `src/open_cinema_index/models/`, you should generate a new migration script:
42+
43+
```bash
44+
alembic revision --autogenerate -m "description of changes"
45+
```
46+
47+
Then, apply the migration as described above.
48+
49+
### Troubleshooting
50+
51+
If migrations fail due to the `data/` directory missing, ensure it exists:
52+
53+
```bash
54+
mkdir -p data
55+
```
56+
57+
## Running Tests
58+
59+
Testing is highly recommended for validating model relationships and ensuring data integrity.
60+
61+
1. Install development dependencies:
62+
```bash
63+
pip install -e ".[dev]"
64+
```
65+
66+
2. Run tests using `pytest`:
67+
```bash
68+
pytest
69+
```

LICENSE.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 Brayniverse
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.

README.md

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
# Open Cinema Index
2+
3+
*Open Cinema Index (OCI)* is a data ingestion and enrichment pipeline for building a structured, open index of films and related entities. It is designed for research, recommendation engines, and archival purposes. The repository contains scripts to fetch film data from open sources, enrich it with metadata, and prepare it for downstream applications.
4+
5+
It is *not* a recommendation engine, a rating platform, or an editorial system.
6+
Its sole responsibility is to build a reliable, inspectable index of film knowledge that other systems can depend on.
7+
8+
OCI is designed to treat cinema as it actually exists: messy, disputed, multilingual, and full of partial truths.
9+
10+
## Features
11+
12+
- Fetch films from Wikidata by year and retrieve basic metadata
13+
- Enrich films with properties such as genre, language, and age ratings
14+
- Designed for offline processing, production applications consume pre-built datasets
15+
16+
## How OCI Thinks About Films
17+
18+
OCI is built around a few guiding ideas:
19+
20+
- Films are stable entities; facts about them are not
21+
- Titles, genres, runtimes, and even credits are _claims_, not facts
22+
- Different sources disagree, and that disagreement is meaningful
23+
24+
Rather than flattening every into a single record, OCI keeps track of:
25+
26+
- who said what
27+
- when they said it
28+
- and how confident we are
29+
30+
Ambiguity is preserved, not "cleaned up".
31+
32+
## The Ingestion Pipeline
33+
34+
OCI is structured as a pipeline of explicit, repeatable steps:
35+
36+
```text
37+
fetch -> normalize -> resolve -> enrich -> export
38+
```
39+
40+
Each step has a narrow responsibility.
41+
42+
### Fetch
43+
44+
Retrieves raw data from a source without interpretation or transformation.
45+
46+
### Normalize
47+
48+
Maps raw data into OCI's canonical schema.
49+
50+
### Resolve
51+
52+
Handles duplicates, identity collisions, and uncertainty between entities.
53+
54+
### Enrich
55+
56+
Adds secondary metadata (genres, assets, keywords, etc.) additively.
57+
58+
### Export
59+
60+
Emits the indexed data in formats suitable for downstream systems.
61+
62+
## Provenance and Confidence
63+
64+
Every piece of data stored by OCI is associated with:
65+
66+
- a source
67+
- a fetch timestamp
68+
- an optional confidence level
69+
70+
Conflicting data is expected and preserved.
71+
"Unknown" and "uncertain" are valid outcomes.
72+
73+
## Why This Exists
74+
75+
Film culture is broader and stranger than most databases allow.
76+
77+
Many existing systems:
78+
79+
- flatten ambiguity
80+
- privilege a single source
81+
- erase minority or regional perspectives
82+
83+
OCI exists to preserve the richness of cinema history without pretending it's tidy.
84+
85+
## Project Status
86+
87+
Open Cinema Index is under active development.
88+
89+
The schema and CLI are expected to evolve.
90+
91+
Contributions are welcome, especially those that respect the project's archival philosophy.
92+
93+
## Environment Variables
94+
95+
The project uses environment variables for secrets. Create a `.env` file based on `.env.example`
96+
97+
```text
98+
WIKIDATA_USER_AGENT=open-cinema-index (your-email@example.com)
99+
TMDB_API_KEY=your_tmdb_api_key_here
100+
```
101+
102+
- `WIKIDATA_USER_AGENT`: Required by Wikidata's API policy. It should identify your tool and provide a way to contact you.
103+
- `TMDB_API_KEY`: Required for fetching posters and other metadata from TMDb.
104+

0 commit comments

Comments
 (0)