Java Code Examples for org.hl7.fhir.dstu3.model.ConceptMap#setId()

The following examples show how to use org.hl7.fhir.dstu3.model.ConceptMap#setId() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: IEEE11073Convertor.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
private static ConceptMap generateLoincMdcMap(CodeSystem mdc, String dst, String src) throws IOException, FHIRException {
  ConceptMap cm = new ConceptMap();
  cm.setId("loinc-mdc");
  cm.setUrl("http:/???/fhir/ConceptMap/loinc-mdc");
  cm.setVersion("[todo]");
  cm.setName("LoincMdcCrossMap");
  cm.setTitle("Cross Map between LOINC and MDC");
  cm.setStatus(PublicationStatus.DRAFT);
  cm.setExperimental(true);
  cm.setDateElement(new DateTimeType());
  cm.setPublisher("HL7, Inc");
  ContactDetail cd = cm.addContact();
  cd.setName("LOINC + IEEE");
  ContactPoint cp = cd.addTelecom();
  cp.setSystem(ContactPointSystem.URL);
  cp.setValue("http://loinc.org");
  cm.setDescription("A Cross Map between the LOINC and MDC Code systems");
  cm.setPurpose("To implementers map between medical device codes and LOINC codes");
  cm.setCopyright("This content LOINC \u00ae is copyright \u00a9 1995 Regenstrief Institute, Inc. and the LOINC Committee, and available at no cost under the license at http://loinc.org/terms-of-use");
  cm.setSource(new UriType("http://loinc.org/vs"));
  cm.setTarget(new UriType(MDC_ALL_VALUES));
  ConceptMapGroupComponent g = cm.addGroup();
  g.setSource("urn:iso:std:iso:11073:10101");
  g.setTarget("http://loinc.org");

  CSVReader csv = new CSVReader(new FileInputStream(src));
  csv.readHeaders();
  while (csv.line()) {
    SourceElementComponent e = g.addElement();
    e.setCode(csv.cell("IEEE_CF_CODE10"));
    e.setDisplay(csv.cell("IEEE_DESCRIPTION"));
    TargetElementComponent t = e.addTarget();
    t.setEquivalence(ConceptMapEquivalence.EQUIVALENT);
    t.setCode(csv.cell("LOINC_NUM"));
    t.setDisplay(csv.cell("LOINC_LONG_COMMON_NAME"));
  }
  new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream(Utilities.path(dst, "conceptmap-"+cm.getId()+".xml")), cm);
  System.out.println("Done");
  return cm;
}