On this page:

22.10smileutil: Import CSV to ConceptMap

 

The import-csv-to-conceptmap command can be used to import a CSV file of terminology mappings and store it as a ConceptMap resource.

The first row of the CSV file is expected to include the following headers:

  • SOURCE_CODE_SYSTEM – ConceptMap.group.source
  • SOURCE_CODE_SYSTEM_VERSION – ConceptMap.group.sourceVersion
  • TARGET_CODE_SYSTEM – ConceptMap.group.target
  • TARGET_CODE_SYSTEM_VERSION – ConceptMap.group.targetVersion
  • SOURCE_CODE – ConceptMap.group.element.code
  • SOURCE_DISPLAY – ConceptMap.group.element.display
  • TARGET_CODE – ConceptMap.group.element.target.code
  • TARGET_DISPLAY – ConceptMap.group.element.target.display
  • EQUIVALENCE – ConceptMap.group.element.target.equivalence (ConceptMapEquivalence)
  • COMMENT – ConceptMap.group.element.target.comment

An example CSV file that describes the mapping of FHIR to HL7v2 for Administrative Gender would appear as follows:

SOURCE_CODE_SYSTEM,SOURCE_CODE_SYSTEM_VERSION,TARGET_CODE_SYSTEM,TARGET_CODE_SYSTEM_VERSION,SOURCE_CODE,SOURCE_DISPLAY,TARGET_CODE,TARGET_DISPLAY,EQUIVALENCE,COMMENT
http://hl7.org/fhir/administrative-gender,,http://hl7.org/fhir/v2/0001,,male,Male,M,Male,equal,
http://hl7.org/fhir/administrative-gender,,http://hl7.org/fhir/v2/0001,,female,Female,F,Female,equal,
http://hl7.org/fhir/administrative-gender,,http://hl7.org/fhir/v2/0001,,other,Other,A,Ambiguous,wider,
http://hl7.org/fhir/administrative-gender,,http://hl7.org/fhir/v2/0001,,unknown,Unknown,U,Unknown,equal,

These terminology mappings could then be imported with the following command:

bin/smileutil import-csv-to-conceptmap -v "r4" -t "http://localhost:8000/" -u "http://hl7.org/fhir/ConceptMap/cm-administrative-gender-v2" -i "http://hl7.org/fhir/ValueSet/administrative-gender" -o "http://hl7.org/fhir/ValueSet/v2-0001" -f "input.csv" -l

Note the source and target value sets are provided when invoking the command.

22.10.1Usage

 
bin/smileutil import-csv-to-conceptmap -v "r4" -t "http://localhost:8000/" -u "http://example.com/conceptmap" -i "http://example.com/valueset/1" -o "http://example.com/valueset/2" -f "input.csv" -l

In the example above, http://localhost:8000/ is the FHIR endpoint to which the mappings will be uploaded.

22.10.2Options

 
  • -v [version] (or --fhir-version [version]) – (optional) The version of FHIR supported by the server.
  • -t [base URL] (or --target [base URL]) – This argument should point to the base URL of the target FHIR server endpoint.
  • -u [ConceptMap URL] (or --url [ConceptMap URL]) – The URL of the ConceptMap resource to be imported/exported (i.e. ConceptMap.url).
  • -i [source URI] (or --input [source URI]) – (optional) The source value set of the ConceptMap to be imported (i.e. ConceptMap.sourceUri).
  • -o [target URI] (or --output [target URI]) – (optional) The target value set of the ConceptMap to be imported (i.e. ConceptMap.targetUri).
  • -f [filename] (or --filename [filename]) – The path and filename of the CSV file to be imported (e.g. ./input.csv).
  • -l or (or --logging) – (optional) If specified, verbose logging will be used.
  • -b [username:password] (or --basic-auth [username:password]) – (optional) If specified, provides a username and password that will be supplied to the server in an HTTP Basic Authorization header in the form of "username:password". If the value supplied is "PROMPT", smileutil will prompt the user to enter credentials interactively.
  • --bearer-token [token](optional) If specified, provides a bearer token that will be supplied to the server in an HTTP Authorization header. If the value supplied is "PROMPT", smileutil will prompt the user to enter a bearer token interactively.