Metadata-Version: 2.4
Name: share-framework
Version: 0.3.0
Summary: SHARE Framework: A universal metric for scientific data sharing quality
Author: Yijian Henry He, Louise Corscadden
Author-email: Shuhan He <research@conductscience.com>
License: Apache-2.0
Project-URL: Homepage, https://github.com/ConductScience-Foundation/share-framework
Project-URL: Documentation, https://github.com/ConductScience-Foundation/share-framework#readme
Project-URL: Repository, https://github.com/ConductScience-Foundation/share-framework
Project-URL: Issues, https://github.com/ConductScience-Foundation/share-framework/issues
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Scientific/Engineering
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: test
Requires-Dist: pytest>=7; extra == "test"
Dynamic: license-file

<p align="center">
  <picture>
    <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/ConductScience-Foundation/share-framework/main/assets/banner-dark.svg">
    <source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/ConductScience-Foundation/share-framework/main/assets/banner-light.svg">
    <img alt="SHARE Framework — Universal Open Metric for Scientific Data Sharing Quality (0-100)" src="https://raw.githubusercontent.com/ConductScience-Foundation/share-framework/main/assets/banner-light.svg" width="100%">
  </picture>
</p>

<p align="center">
  <a href="https://github.com/ConductScience-Foundation/share-framework/actions/workflows/ci.yml"><img alt="CI Status" src="https://github.com/ConductScience-Foundation/share-framework/actions/workflows/ci.yml/badge.svg"></a>
  <a href="https://pypi.org/project/share-framework/"><img alt="PyPI" src="https://img.shields.io/pypi/v/share-framework?color=1E42A8&labelColor=0F172A"></a>
  <img alt="Rubric 2.0.0-beta.1" src="https://img.shields.io/badge/rubric-2.0.0--beta.1-059669?labelColor=0F172A">
  <img alt="Result Contract 1.0.0" src="https://img.shields.io/badge/result%20contract-1.0.0-D97706?labelColor=0F172A">
  <img alt="License Apache-2.0" src="https://img.shields.io/badge/license-Apache--2.0-0F172A?labelColor=0F172A">
</p>

# SHARE Framework

> **An open Python implementation of SHARE, a 0-100 measure of scientific data sharing quality, and the researcher S-Index.** 25 deposit-time signals across 5 buckets (`S, H, A, R, E`), strict 6-state terminal semantics, zero outcome contamination, and SHA-256 verified JSON result contracts.

Built by **[Shuhan He](https://github.com/ShuhanCS)** (`https://github.com/ShuhanCS`), Yijian Henry He, and Louise Corscadden with **[ConductScience](https://conductscience.com)** (`https://conductscience.com`), published through **[ConductScience Foundation](https://github.com/ConductScience-Foundation)** (`https://conductsciencefoundation.org`). Live platform: **https://sharescore.org**.

<p align="center">
  <sub>ATTRIBUTED TO &amp; SUPPORTED BY</sub>
  <br/><br/>
  <a href="https://conductscience.com"><picture><source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/ConductScience-Foundation/.github/main/assets/cs-badge-dark.svg"><img alt="ConductScience" src="https://raw.githubusercontent.com/ConductScience-Foundation/.github/main/assets/cs-badge-light.svg" height="38" align="middle"></picture></a>
  &nbsp;&nbsp;&nbsp;
  <a href="https://github.com/ShuhanCS"><picture><source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/ConductScience-Foundation/.github/main/assets/shuhancs-badge-dark.svg"><img alt="Shuhan He (@ShuhanCS)" src="https://raw.githubusercontent.com/ConductScience-Foundation/.github/main/assets/shuhancs-badge-light.svg" height="38" align="middle"></picture></a>
</p>

---

## Architecture Overview

Package `0.3.0` keeps two scoring paths explicitly separated so callers never silently receive changed numbers:

- `SHAREScorer()` preserves the `0.1.0` prototype exactly and reports rubric `legacy-prototype-0.1.0`.
- `SHAREScorer(rubric="2.0.0-beta.1")` explicitly selects the validated SHARE 2.0 candidate (not adopted as the live scoring model).

Package, rubric, prose-specification, and validation-suite versions are reported separately so every score can be reproduced without guessing which definition produced it.

<p align="center">
  <picture>
    <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/ConductScience-Foundation/share-framework/main/assets/share-rubric-diagram-dark.svg">
    <source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/ConductScience-Foundation/share-framework/main/assets/share-rubric-diagram-light.svg">
    <img alt="SHARE 2.0 Scoring Architecture: 25 Signals Across 5 Buckets" src="https://raw.githubusercontent.com/ConductScience-Foundation/share-framework/main/assets/share-rubric-diagram-light.svg" width="100%">
  </picture>
</p>

---

## SHARE Open Ecosystem

| Component | Repository / URL | Role |
| --- | --- | --- |
| **SHARE Framework (this repo)** | https://github.com/ConductScience-Foundation/share-framework | Core Python scorer (`0.3.0`), canonical result schema (`1.0.0`), and S-Index computation |
| **SHARE Implementation** | https://github.com/ConductScience-Foundation/share-implementation | Streaming production-snapshot scoring runner, adapters, and validation suite (`0.5.0`, 229 tests) |
| **SHARE Pledges** | https://github.com/ConductScience-Foundation/share-pledges | Open capability registry for 11 major scientific repositories (`0.7.0`, CC0 pledges) |
| **ShareScore Live Platform** | https://sharescore.org | Public dataset scores, researcher S-Index profiles, and repository comparisons |
| **ShareScore Public API** | https://api.sharescore.org/docs | Programmatic API for live scored records |

---

## SHARE 2.0 Beta Specification

The candidate has five deposit-time buckets, each containing five signals:

| Bucket | Name | Candidate signals | Maximum |
| --- | --- | --- | ---: |
| `S` | Stewardship | Geographic context, temporal context, contributor roles, subject classification, ethical transparency | 20 |
| `H` | Harmonization | Methods, contributor PID, organization PID, references, description quality | 20 |
| `A` | Access | Access status, license clarity, license permissiveness, no embargo, format openness | 20 |
| `R` | Reusability | Documentation artifact, analysis code, package manifest, transparent packaging, meaningful filenames | 20 |
| `E` | Engagement | Related publication, related data/software, funding, version tracking, community standards | 20 |

Each canonical signal from `S1` through `E5` ends in exactly one terminal state: `present`, `absent`, `unsupported`, `not_evaluable`, `source_missing`, or `failed`. Only `present` earns four points. Every other state earns zero; the denominator always remains 25 and is never reweighted.

Boolean inputs remain concise aliases: `True` means `present`, `False` means `absent`, explicit `None` means `not_evaluable`, and an omitted signal means `source_missing`. Named terminal states and structured decisions are available when an adapter needs to preserve exact reasons and evidence receipts.

| State | Meaning | Points |
| --- | --- | ---: |
| `present` | The source evidence satisfies the signal decision. | 4 |
| `absent` | The signal is evaluable and the evidence does not satisfy it. | 0 |
| `unsupported` | The repository adapter cannot measure this signal. | 0 |
| `not_evaluable` | The adapter supports the signal, but this record cannot be evaluated. | 0 |
| `source_missing` | Required source evidence is missing from the record or snapshot. | 0 |
| `failed` | Evaluation was attempted but did not complete successfully. | 0 |

Views, downloads, citations, derivatives, and mentions may be supplied for reporting, but they never affect a 2.0 beta score. In particular, the `R` bucket measures deposit-time reusability rather than accumulated popularity.

| Canonical outcome | Accepted input names |
| --- | --- |
| `views` | `views`, `view_count` |
| `downloads` | `downloads`, `download_count` |
| `citations` | `citations`, `citation_count` |
| `derivatives` | `derivatives`, `derivative_count`, `derived_count` |
| `mentions` | `mentions`, `mention_count` |

Aliases normalize to the canonical name. Supplying aliases for the same outcome with different values raises an error.

---

## Quickstart

### Install

```bash
pip install share-framework
```

Or install from source for development:

```bash
git clone https://github.com/ConductScience-Foundation/share-framework.git
cd share-framework
python -m pip install -e ".[test]"
```

### Score with the SHARE 2.0 Candidate

```python
from share import BETA_RUBRIC_VERSION, SHAREScorer

record = {
    "record_id": "10.1234/example",
    "repository_id": "example-repository",
    "signals": {
        "S1": {
            "state": "present",
            "evidence": [{
                "kind": "source_field",
                "source": "https://example.org/api/records/123",
                "locator": "$.metadata.spatial",
            }],
        },
        "S2": False,
        "S3": "unsupported",
        "H1": True,
        "A1": True,
        "R1": True,
        "E1": True,
    },
    "reported_unscored": {"downloads": 12_000},
}

scorer = SHAREScorer(rubric=BETA_RUBRIC_VERSION)
result = scorer.score(record)
document = result.as_dict()

print(result.total)                    # 20.0
print(result.rubric_version)           # 2.0.0-beta.1
print(result.rubric_status)            # validated_candidate
print(result.reported_unscored)        # outcomes retained for reporting
print(result.rubric_fingerprint)       # semantic contract SHA-256
print(document["result_contract"])     # canonical result schema identity
```

Run the complete example script:

```bash
python examples/score_beta.py
```

The scorer also accepts the historical flat signal mapping. Unknown top-level fields, unknown nested fields, conflicting aliases, malformed evidence receipts, and invalid terminal states fail closed.

The canonical result contract is bundled at `share/contracts/share-score-result-1.0.0.json`. Every result includes all 25 terminal states, per-signal evidence, fixed score math, per-bucket state counts, rubric fingerprints, producer identity, record identity, and normalized unscored outcomes.

An evidence receipt requires `kind` and `source`; it may also carry `locator`, `observed_at`, `sha256`, and `note`. Canonical results emit all six receipt fields, using `null` for omitted optional values, and reject additional fields. Allowed kinds are `source_field`, `source_file`, `api_response`, `detector`, `policy`, `error`, and `other`.

---

## Legacy Compatibility Path

The default remains the original `0.1.0` prototype so existing callers do not silently receive different scores:

```python
from share import SHAREScorer

scorer = SHAREScorer()
result = scorer.score({
    "has_consent": True,
    "has_deidentification": True,
    "has_temporal_coverage": True,
    "has_contributors": True,
    "has_methods": True,
    "has_contributor_pids": True,
    "has_references": True,
    "has_description": True,
    "is_open_access": True,
    "has_license": True,
    "is_permissive_license": True,
    "has_download_url": True,
    "citation_count": 42,
    "has_related_publications": True,
    "has_funding": True,
    "has_version": True,
    "has_keywords": True,
})

print(result)
# SHAREResult(S=16, H=16, A=20, R=8.2, E=16, total=76.2)
print(result.rubric_version)
# legacy-prototype-0.1.0
```

`SignalMapping` remains available for existing repository-specific legacy adapters and is intentionally rejected by the 2.0 beta scorer, which accepts already-measured canonical signal states.

---

## S-Index

The S-Index is computed from a collection of SHARE results:

> A researcher has an S-Index of *k* when they have *k* datasets, each with a SHARE score of at least *k*.

```python
results = scorer.score_batch(records)
s_index = scorer.compute_s_index(results)
```

---

## Scope: In Scope vs. Out of Scope

- **In scope:** deterministic 0-100 SHARE scoring, canonical result contract verification, evidence receipt validation, outcome normalization, and S-Index computation.
- **Out of scope:** raw repository harvesting, API crawling, and live repository metadata mapping (see https://github.com/ConductScience-Foundation/share-implementation and https://github.com/ConductScience-Foundation/share-pledges).

---

## Contract Provenance & Reproducibility

Loading the bundled contract at `share/contracts/share-rubric-2.0.0-beta.1.json` verifies the file, semantic contract, signal-ID set, scoring math, and non-adoption status before a record can be scored:

| Field | Value |
| --- | --- |
| Package version | `0.3.0` |
| Result contract | `1.0.0` |
| Result-schema SHA-256 | `15511852313787f6015fecdcc2a009353d9ce4015cb794d3b631595367a78b3e` |
| Rubric version | `2.0.0-beta.1` |
| Prose specification | `2.0.3` |
| Validation suite | `2.8.0` |
| Semantic contract SHA-256 | `f0560741d2014d541a6a5f322985613e92b5c997d4128145f64c7b915e9438a8` |
| Signal-ID SHA-256 | `2d71498895ccafbca8bcb80122f165222f9b7baa4809a41cf0903d099a29e012` |

See [REPRODUCIBILITY.md](REPRODUCIBILITY.md) for evidence scope and exact reproduction paths.

---

## Testing

```bash
python -m pytest -v
```

---

## Attribution, Links & Citation

- **Repository:** https://github.com/ConductScience-Foundation/share-framework
- **Live ShareScore Platform:** https://sharescore.org
- **ConductScience:** https://conductscience.com
- **ConductScience Open Research:** https://conductscience.org
- **ConductScience Foundation:** https://conductsciencefoundation.org
- **Stewards:**
  - Shuhan He, MD (Scientific Steward): https://github.com/ShuhanCS (ORCID: https://orcid.org/0000-0002-9902-5077)
  - Yijian Henry He, PhD (Technical Steward)
  - Louise Corscadden, PhD (Community Steward)
- **License:** Apache License 2.0 ([LICENSE](LICENSE))
- **Citation:** See [CITATION.cff](CITATION.cff):

```text
He S, He YH, Corscadden L. SHARE Framework: A Universal Metric for
Scientific Data Sharing Quality. ConductScience Foundation, 2026.
https://sharescore.org
```
