Original code copyright (C) 2009-2022 Rudolf Cardinal (

This file is part of cardinal_pythonlib.

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Convert SNOMED-CT codes, and their children, to OPCS4 procedure codes, given an appropriate SNOMED-and-OPCS download from Athena OHDSI; see See More generally, does this for any pair of vocabularies.


cardinalpythonlib_convert_athena_ohdsi_codes 175898006 118677009 265764009 --src_vocabulary SNOMED --descendants --dest_vocabulary OPCS4 > renal_procedures_opcs4.txt
# ... kidney operation, procedure on urinary system, renal dialysis None[source]

Command-line entry point. str, source_codes: List[int], destination_vocabulary: str, concept_file: str, concept_relationship_file: str, with_descendants: bool = False) None[source]

Print codes from another vocabulary equivalent to the supplied source codes and (optionally) their descendants.

  • source_vocabulary – source vocabulary, e.g. SNOMED

  • source_codes – list of source (e.g. SNOMED-CT) codes to use

  • destination_vocabulary – destination vocabulary

  • concept_file – Athena OHDSI CONCEPT.csv TSV file, containing both vocabularies

  • concept_relationship_file – Athena OHDSI CONCEPT_RELATIONSHIP.csv TSV file, containing both vocabularies

  • with_descendants – include all descendants of the codes specified?