Skip to content

Commit 0623ff0

Browse files
committed
docs: add example usage of ProfiencyScore and TranscriptEntry
1 parent 20f64e4 commit 0623ff0

1 file changed

Lines changed: 47 additions & 0 deletions

File tree

README.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,53 @@ t_algebra = Topic(
9090
)
9191
```
9292

93+
### Create a Proficiency Score, by name
94+
95+
A **Proficiency Score** represents a person's level of proficiency in a specific topic.
96+
97+
```python
98+
proficiency_score = ProficiencyScore(
99+
topic_id="addition",
100+
score=ProficiencyScoreName.PROFICIENT
101+
)
102+
```
103+
104+
### Create a Proficiency Score, numerically
105+
106+
All score are internally numeric from 0.0 to 1.0, even if set using the score name (above).
107+
108+
```python
109+
proficiency_score = ProficiencyScore(
110+
topic_id="arithmetic",
111+
score=0.8 # Same as 'ProficiencyScoreName.PROFICIENT'
112+
)
113+
```
114+
115+
### Issue a Transcript Entry
116+
117+
A **Transcript Entry** associates a proficiency score to a user and is claimed by an issuer.
118+
119+
```python
120+
from openproficiency import TranscriptEntry
121+
122+
# Create a transcript entry
123+
entry = TranscriptEntry(
124+
user_id="john-doe",
125+
topic_id="arithmetic",
126+
score=0.9,
127+
issuer="university-of-example"
128+
)
129+
130+
# Access the transcript entry information
131+
print(entry.user_id) # john-doe
132+
print(entry.proficiency_score.score) # 0.9
133+
print(entry.issuer) # university-of-example
134+
print(entry.timestamp) # datetime object
135+
136+
# Convert to JSON for storage or transmission
137+
entry_json = entry.to_json()
138+
```
139+
93140
## How to Develop
94141

95142
This project is open to pull requests.

0 commit comments

Comments
 (0)