You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Add .claude/ to .gitignore
* cargo fmt
* Fix test-python: use maturin develop so tests see current Rust code
maturin build produces a wheel but does not install it into the active
venv, so tests were running against whatever was last manually installed.
Use maturin develop instead, which builds and installs into the active
venv. Requires sourcing bindings/python/.venv/bin/activate before just ci.
* Add Code newtype to types module
Newtype wraps String with compile-time distinction only — no content
validation at this layer. serde(transparent) keeps the wire format as
a plain JSON string. Canonical conversions via From<String>, From<&str>,
and From<Code> for String.
* Add NormalizedCode, Term, CodeSystemId, Contributor, CodeListId newtypes
* Migrate Provenance.contributors to IndexSet<Contributor>
CodeListError::ContributorNotFound now carries a Contributor (not
String), so remove_contributor takes Contributor by value and moves
it into the error on the not-found path — no as_str().to_string()
dance.
Python binding's add_contributor, remove_contributor, and the
Provenance::new call site in PyCodeList::new wrap incoming strings
with Contributor::from at the FFI boundary. Python-facing signatures
remain String; the binding exposes contributors as native strings
via as_str().
Copy file name to clipboardExpand all lines: rust/codelist-builder-rs/src/snomed_usage_data.rs
+37-19Lines changed: 37 additions & 19 deletions
Original file line number
Diff line number
Diff line change
@@ -4,47 +4,65 @@
4
4
//! Components of the file:
5
5
//!
6
6
//! SNOMED_Concept_ID:
7
-
//! SNOMED concepts which have been added to a patient record in a general practice system during the reporting period.
7
+
//! SNOMED concepts which have been added to a patient record in a general
8
+
//! practice system during the reporting period.
8
9
//!
9
10
//! Description:
10
-
//! The fully specified name associated with the SNOMED_Concept_ID on the final day of the reporting period (31 July).
11
+
//! The fully specified name associated with the SNOMED_Concept_ID on the final
12
+
//! day of the reporting period (31 July).
11
13
//!
12
14
//! Usage:
13
-
//! The number of times that the SNOMED_Concept_ID was added into any patient record within the reporting period, rounded to the nearerst 10. Usage of 1 to 4 is displayed as *. SNOMED concepts with no code usage are not included.
15
+
//! The number of times that the SNOMED_Concept_ID was added into any patient
16
+
//! record within the reporting period, rounded to the nearerst 10. Usage of 1
17
+
//! to 4 is displayed as *. SNOMED concepts with no code usage are not included.
14
18
//! Important notes:
15
-
//! - Data prior to 2019 was originally submitted mostly in READ V2 or CTV3, but in the usage files, these codes have been mapped to corresponding SNOMED codes using final 2020 version of the mapping tables published by NHS England.
16
-
//! - The usage does not show how many patients had each code added to their record - each addition regardless of whether it is the same patient increments the count by 1. Therefore it is not possible to infer the number of individual patients with a particular code.
17
-
//! - For the 2011-12 to 2017-18 data, it is stated that "Current maximum value is approximately 250,000,000" - no such maximum is stated for the 2018-19 onwards data.
19
+
//! - Data prior to 2019 was originally submitted mostly in READ V2 or CTV3, but
20
+
//! in the usage files, these codes have been mapped to corresponding SNOMED
21
+
//! codes using final 2020 version of the mapping tables published by NHS
22
+
//! England.
23
+
//! - The usage does not show how many patients had each code added to their
24
+
//! record - each addition regardless of whether it is the same patient
25
+
//! increments the count by 1. Therefore it is not possible to infer the
26
+
//! number of individual patients with a particular code.
27
+
//! - For the 2011-12 to 2017-18 data, it is stated that "Current maximum value
28
+
//! is approximately 250,000,000" - no such maximum is stated for the 2018-19
29
+
//! onwards data.
18
30
//!
19
31
//! Active_at_Start:
20
-
//! Active status of the SNOMED_Concept_ID on the first day of the reporting period. This is taken from the most recent UK clinical extension, or associated International extention, which was published up to the start of the reporting year (1 August).
21
-
//! 1 = SNOMED concept was published and was active.
22
-
//! 0 = SNOMED concept was either not yet available or was inactive.
32
+
//! Active status of the SNOMED_Concept_ID on the first day of the reporting
33
+
//! period. This is taken from the most recent UK clinical extension, or
34
+
//! associated International extention, which was published up to the start of
35
+
//! the reporting year (1 August). 1 = SNOMED concept was published and was
36
+
//! active. 0 = SNOMED concept was either not yet available or was inactive.
23
37
//!
24
38
//! Active_at_End:
25
-
//! Active status of the SNOMED_Concept_ID on the last day of the reporting period. This is taken from the most recent UK clinical extension, or associated International extention, which was published up to the end of the reporting year (31 July).
26
-
//! 1 = SNOMED concept was published and was active.
39
+
//! Active status of the SNOMED_Concept_ID on the last day of the reporting
40
+
//! period. This is taken from the most recent UK clinical extension, or
41
+
//! associated International extention, which was published up to the end of the
42
+
//! reporting year (31 July). 1 = SNOMED concept was published and was active.
27
43
//! 0 = SNOMED concept was either not yet available or was inactive.
28
44
29
-
use std::fs;
30
-
31
-
// Internal imports
32
-
usecrate::errors::CodeListBuilderError;
45
+
use std::{collections::HashMap, fs};
33
46
34
47
// External imports
35
48
use csv;
36
49
use reqwest;
37
50
use serde::{Deserialize,Serialize};
38
-
use std::collections::HashMap;
51
+
52
+
// Internal imports
53
+
usecrate::errors::CodeListBuilderError;
39
54
40
55
/// Struct to represent a snomed usage data entry
41
56
///
42
57
/// # Fields
43
58
/// * `snomed_concept_id` - The snomed concept id
44
59
/// * `description` - The description
45
-
/// * `usage` - The usage. A count of 1-4 is denoted by a *. Counts above 4 are denoted by a number rounded to the nearest 10.
46
-
/// * `active_at_start` - Whether the concept was active at the start of the usage period
47
-
/// * `active_at_end` - Whether the concept was active at the end of the usage period
60
+
/// * `usage` - The usage. A count of 1-4 is denoted by a *. Counts above 4 are
61
+
/// denoted by a number rounded to the nearest 10.
62
+
/// * `active_at_start` - Whether the concept was active at the start of the
63
+
/// usage period
64
+
/// * `active_at_end` - Whether the concept was active at the end of the usage
0 commit comments