The XML4Pharma Application Server

XML4Pharma LOINC to CDISC Mapping Web Services

We have developed a good number of RESTful Web Services for interfacing LOINC, the universal code system for medical lab tests, measurements, and observations, with the CDISC SDTM standard

These mappings, and especially the RESTful Web Services implementing the mapping, allow automated generation of SDTM datasets from EHR systems, as was demonstrated during the Virtual CDISC European Interchange.

Latest LOINC version implemented: 2.73 (2022-08-08)

The following RESTful LOINC-CDISC-SDTM web services are currently available:

Important notes for mappers using SDTMIG-3.4


As of 2020-09-11, this RESTful web service implements the final version of the CDISC LOINC-SDTM-LB mapping (it used a draft before).
This mapping is available as an Excel and CSV file published by CDISC from:
Due to the publication, we could finally update the underlying database. This also means that some results may slightly differ from what was obtained before 2020-09-11.


providing the SDTM variable and values corresponding to the LOINC code 1751-7: Albumin [Mass/volume] in Serum or Plasma

LOINC to CDISC-SDTM-LB Extended Mapping

The LOINC to CDISC-SDTM-LB mapping published by CDISC is limited to the most used 1400 laboratory LOINC test codes, resulting in 2304 mappings.
But what if your LOINC code is not among these 1400? Revert to manual work?
We have developed an algorithm to extend the published mappings with approximately 4,800 additional mappings. These mappings are algorithmically derived, and have been curated very carefully. It can however not be expected that they are of the same high quality as the by CDISC published mappings. They can however help in generating a "highly educated guess" for the SDTM variables and values in the case the LOINC laboratory code is not among the 1400 ones.
The RESTful web service request is identical to that for the by CDISC published LOINC mappings, with the difference that the response has the attribute
MappingSource="XML4Pharma" on the element "LOINC2SDTMMapping". This allows programs and users to select/filter whether they want to use the extended mapping or not.


providing the SDTM variable and values corresponding to the LOINC code 34183-4: Beta globulin to ratio in 24 hour Urine

May 2021: 8684 mappings for 3427 LOINC "Challenge" codes have been added, which is for 88% of the LOINC Challenge codes. The remaining 12% represent codes for which there currently is no LBTESTCD/LBTEST pair available (and for which we will do a "new term request".
These mappings required the addition of the timing variables LBTPTNUM (representing the "n-th sample"), LBELTM (time pre- or post challenge dose), and LBTPTREF (description of the challenge dose). Some examples to try out: LOINC codes 72415-3 (acetoacetate in blood post meal), 58526-5 (Corticotropin in plasma 1.5 hour post dose glucagon), 58538-0 (Corticotropin in plasma 10th specimen post XXX challenge), 2005-7 (Calcium in urine 12 hours post fasting)

February 2021: 1733 mappings were added for drug/toxicology tests, representing 1301 distinct LOINC codes. This set of mappings will in future be further extended, as no LBTESTCD/LBTEST pair is already available for many of the substances that are subject of the test (there are over 8,000 LOINC codes in the class 'DRUG/TOX'). We are currently discussing with the CDISC-CT team for which (types of codes) "new term requests" will be submitted.
When using the RESTful web service, these mappings are marked by a value of "XML4PharmaDrugTox" for the "MappingSource" attribute.

providing the SDTM variable and values corresponding to the LOINC code 10369-7: Opiates, mass concentration in hair.

LOINC Corona Virus Tests to CDISC-SDTM-MB Mapping

This mapping has been developed in the scope of the worldwide COVID-19 pandemic for the new LOINC test codes on Corona virus. It should enable researchers with access to data from EHR systems to fully automatically generate SDTM-MB (Microbiology) datasets directly from the EHR records, as these are usually coded using LOINC. These new LOINC codes are now already used my a large number of test manufacturers.

The mapping has been developed by us in close cooperation with the CDISC "Interim User Guide for COVID-19" team, but is not part of the User Guide itself.
Please remark that the mapping is NOT an official CDISC project!

Latest update: 2021-04-25 (151 mappings), also with newest CDISC published controlled terminology 2021-03-26.

Remark: we are currently also working on adding mappings for older codes for Corona-virus (pre-2) tests, for example for SARS coronavirus Urbani (outbreak in 2003 in Vietnam). These codes are limited to human Corona-virus, so e.g. "bovine Corona-virus" will not be included. The number of LOINC codes obtained (and to be mapped) is 96.

Minor update 2021-01-12: added MBSPCCND, as e.g. "dried blood spot" must now (according to CDISC-CT team) be mapped to MBSPEC=BLOOD, MBSPCCND=DRIED

Resulting in:


For the latest published set of Corona-related LOINC codes (for which for most of them we developed a mapping), please visit the LOINC website.


Special thanks to Amy Palmer, Jon Neville (both CDISC) and Erin Muhlbradt (NCI) for the many discussions and suggestions.

LOINC Corona Virus Tests to CDISC-SDTM-MB Mapping - Extended

The RESTful web service extends the CDISC-SDTM-MB Mapping mapping with additional information regarding the LOINC core properties, and applicable units and LOINC answer lists. The latter are especially recommended for use in MBSTRESC, as they map 1:1 with what is used in Electronic Health Records (EHR), and in Real World Data (RWD). This allows regulatory authorities to directly compare/combine the submitted SDTM records with data from EHRs and RWD - they will be grateful to you!

Resulting in additional information:

Or for a quantitative test, such as LOINC 94769-7 "SARS coronavirus 2 Antibody [Units/volume] in Serum or Plasma by Immunoassay":


We have developed a mapping between the LOINC vital signs test codes and the CDISC-SDTM VS (Vital Signs) domain.

The mapping contains 617 LOINC codes, some of which might however need to be assigned to another SDTM domain than VS: we need to take into account that the assignment of a test or finding to a specific domain is extremely arbitrary! In our opinion, the split up of findings in SDTM into different domains has been a major design error (*1): I remember (many many years ago) that the CTO of CDISC stated at a conference that there would never be more than 20 domains - we are now at approximately 50... HL7-FHIR did it better: for the "Observations" resource (the equivalent of SDTM "Findings"), there is no split up in domains: an Observation is just an Observation, with the test in most cases characterized by a LOINC code (*2).

We developed this mapping as there are currently no plans at CDISC to extend the LOINC to SDTM mappings beyond the 2000+ Lab test codes. We do however regard such a mapping (to VS) as absolutely necessary for those who want to automate the generation of SDTM-VS records from EHRs that use LOINC coding, such as most systems that have an HL7-FHIR RESTful API

(LOINC code 8315-4: Maximum body temperature in a period of 24 hours)
Resulting in:


Generic LOINC to CDISC-SDTM Mapping

In case you (or your system) does not know what SDTM domain the LOINC code maps to, you can use the "generic" service


Depending on what the LOINC code maps to according to our system, the server will either return an LB, an MB or a VS mapping.
This allows us to easily extend the mappings to also other domains in future (e.g. EG, QS, ...).
If your LOINC code is not valid, or there is no mapping (yet) for your LOINC code, the response of the server will contain a "Warning" element.

Examples: will return a "VS" mapping. will return an "LB" mapping. will return an "MB" (COVID-19) mapping.

It is then important that you (or better, your system) then picks up the assigned domain, and use the mapping accordingly (e.g. in automatically generating SDTM datasets), by taking the value in the "SDTMTargetDomain" attribute:

List of LOINC to CDISC-SDTM Mappings

On general request, we also implemented a RESTful web service to provide a list of all LOINC codes for which a mapping is available.


Where the value of {domain} can currently be "LB", "MB", "VS", or "ALL". In the latter case, the system will return a list of all mappings available.

A parameter "MappingSource" can be added. It's value can either be "CDISC" or "XML4Pharma". This allows your system to filter on whether the mappings have been developed by CDISC (CDISC currently only developed mappings for MB) or by XML4Pharma.

Examples: provides a list of all currently LOINC codes for which mappings have been developed and to which domain and by which organization. provides a list of all currently LOINC codes for which mappings have been developed by CDISC. provides a list of all currently LOINC codes for which mappings have been developed to the VS domain. provides a list of all currently LOINC codes for which mappings have been developed to the MB domain. These are however only COVID-19 related LOINC codes.

Remark that especially for VS and MB, the list of codes and the mappings are regularly updated.

Further remarks

Also see our blogs at blogspot

If you have any suggestions for other web services which have to do with LOINC, UCUM, CDISC and CDISC Controlled Terminology, please let us know.

*1: This has possibly to do with the limitations of the SAS Transport 5 (XPT) format, which is extremely inefficient, the fear for large file sizes (FDA still uses files, seems to be uncapable to store submissions in databases), and making the submission "reviewer-friendly" by doing the work in advance the reviewer should do (and can be automated anyway)
*2: HL7 FHIR does also not know the concept of "file". Everything is a resource that can be located anywhere, and can be referenced from everywhere.

Courtesy of XML4Pharma - last update: June 2021