43.7.1smileutil: 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.

Note: In cases where multiple versions of a given ConceptMap have been loaded, the import-csv-to-conceptmap command will always replace the current version of the specified ConceptMap resource with the imported ConceptMap.

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" -s "active" -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.

43.7.2Usage

 
bin/smileutil import-csv-to-conceptmap -v "r4" -t "http://localhost:8000/" -u "http://example.com/conceptmap" -s "active" -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.

43.7.3Options

 
  • -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.
  • --debug – Enable debug mode.
  • -f [filename] (or --filename [filename]) – The path and filename of the CSV file to be imported (e.g. ./input.csv).
  • -hp [header] (or --header-passthrough [header]) – If specified, this argument specifies headers to include in the generated request.
  • -i [source URI] (or --input [source URI]) – (optional) The source value set of the ConceptMap to be imported (i.e. ConceptMap.sourceUri).
  • -l (or --logging) – (optional) If specified, verbose logging will be used.
  • -o [target URI] (or --output [target URI]) – (optional) The target value set of the ConceptMap to be imported (i.e. ConceptMap.targetUri).
  • -s [ConceptMap Status] (or --status [ConceptMap Status]) – The status of the ConceptMap resource to be imported (i.e. ConceptMap.status).
  • -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).
  • -v [version] (or --fhir-version [version]) – (optional) The version of FHIR supported by the server.
  • --tls-auth [filename](optional) If specified, this parameter supplies a path and filename for a Smile Util TLS JSON Authentication File that will be used to authenticate target FHIR server endpoints secured through HTTPS.