public static org.hl7.fhir.dstu2016may.model.Narrative convertNarrative(org.hl7.fhir.dstu3.model.Narrative src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.dstu2016may.model.Narrative tgt = new org.hl7.fhir.dstu2016may.model.Narrative(); copyElement(src, tgt); tgt.setStatus(convertNarrativeStatus(src.getStatus())); tgt.setDiv(src.getDiv()); return tgt; }
public org.hl7.fhir.instance.model.Narrative convertNarrative(org.hl7.fhir.dstu3.model.Narrative src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.instance.model.Narrative tgt = new org.hl7.fhir.instance.model.Narrative(); copyElement(src, tgt); tgt.setStatus(convertNarrativeStatus(src.getStatus())); tgt.setDiv(src.getDiv()); return tgt; }
protected String addReference(DomainResource r, String title, String id) throws Exception { if (r.getText() == null) r.setText(new Narrative()); if (r.getText().getDiv() == null) { r.getText().setStatus(NarrativeStatus.GENERATED); new NarrativeGenerator("", "", context).generate(r); } r.setMeta(new Meta().setLastUpdatedElement(InstantType.now())); r.setId(id); feed.getEntry().add(new BundleEntryComponent().setResource(r)); return id; }
private void loadCache() throws FHIRFormatError, IOException { File[] files = new File(cacheFolder).listFiles(); for (File f : files) { if (f.getName().endsWith(".xml")) { final FileInputStream is = new FileInputStream(f); try { Resource r = context.newXmlParser().setOutputStyle(OutputStyle.PRETTY).parse(is); if (r instanceof OperationOutcome) { OperationOutcome oo = (OperationOutcome) r; expansions.put(ToolingExtensions.getExtension(oo,VS_ID_EXT).getValue().toString(), new ValueSetExpansionOutcome(new XhtmlComposer(XhtmlComposer.XML).composePlainText(oo.getText().getDiv()), TerminologyServiceErrorClass.UNKNOWN)); } else { ValueSet vs = (ValueSet) r; expansions.put(vs.getUrl(), new ValueSetExpansionOutcome(vs)); } } finally { IOUtils.closeQuietly(is); } } } }
public void parseResource( final JCas jCas, final Basic resource ) { // composition.addAuthor( practitioner.getPractitionerReference() ); // composition.setId( FhirElementFactory.createId( jCas, ID_NAME_COMPOSITION, noteSpecs.getNoteTime() ) ); // composition.setStatus( Composition.CompositionStatus.FINAL ); // composition.setType( getCompositionType() ); // composition.setLanguage( "English" ); // composition.setSubject( noteSpecs.getSubjectReference( FhirNoteSpecs.SUBJECT_PATIENT ) ); // The following claim to have a 0 .. 1 cardinality, but the doc also states that they SHALL be listed. // composition.setEncounter( noteSpecs.getEncounterReference() ); // composition.setCustodian( practitioner.getOrganizationReference() ); // composition.addEvent( noteSpecs.getEvent() ); // composition.addAttester( practitioner.createAttester( noteSpecs ) ); // composition.setText( FhirElementFactory.createNarrative( jCas.getDocumentText() ) ); final Narrative narrative = resource.getText(); final XhtmlNode htmlNode = narrative.getDiv(); final String docText = htmlNode.allText(); jCas.setDocumentText( docText ); }
public static org.hl7.fhir.dstu2016may.model.Narrative convertNarrative(org.hl7.fhir.dstu3.model.Narrative src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.dstu2016may.model.Narrative tgt = new org.hl7.fhir.dstu2016may.model.Narrative(); copyElement(src, tgt); tgt.setStatus(convertNarrativeStatus(src.getStatus())); tgt.setDiv(src.getDiv()); return tgt; }
public org.hl7.fhir.instance.model.Narrative convertNarrative(org.hl7.fhir.dstu3.model.Narrative src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.instance.model.Narrative tgt = new org.hl7.fhir.instance.model.Narrative(); copyElement(src, tgt); tgt.setStatus(convertNarrativeStatus(src.getStatus())); tgt.setDiv(src.getDiv()); return tgt; }
public StructureMap generateMapFromMappings(StructureDefinition sd) throws IOException, FHIRException { String id = getLogicalMappingId(sd); if (id == null) return null; String prefix = ToolingExtensions.readStringExtension(sd, ToolingExtensions.EXT_MAPPING_PREFIX); String suffix = ToolingExtensions.readStringExtension(sd, ToolingExtensions.EXT_MAPPING_SUFFIX); if (prefix == null || suffix == null) return null; // we build this by text. Any element that has a mapping, we put it's mappings inside it.... StringBuilder b = new StringBuilder(); b.append(prefix); ElementDefinition root = sd.getSnapshot().getElementFirstRep(); String m = getMapping(root, id); if (m != null) b.append(m+"\r\n"); addChildMappings(b, id, "", sd, root, false); b.append("\r\n"); b.append(suffix); b.append("\r\n"); StructureMap map = parse(b.toString()); map.setId(tail(map.getUrl())); if (!map.hasStatus()) map.setStatus(PublicationStatus.DRAFT); map.getText().setStatus(NarrativeStatus.GENERATED); map.getText().setDiv(new XhtmlNode(NodeType.Element, "div")); map.getText().getDiv().addTag("pre").addText(render(map)); return map; }
protected String addReference(DomainResource r, String title, String id) throws Exception { if (r.getText() == null) r.setText(new Narrative()); if (r.getText().getDiv() == null) { r.getText().setStatus(NarrativeStatus.GENERATED); new NarrativeGenerator("", "", context).generate(r); } r.setMeta(new Meta().setLastUpdatedElement(InstantType.now())); r.setId(id); feed.getEntry().add(new BundleEntryComponent().setResource(r)); return id; }
if ( resource instanceof Composition ) { final Narrative narrative = ((Composition) resource).getText(); final XhtmlNode html = narrative.getDiv(); final String docText = html.allText(); jCas.setDocumentText( docText );
if ( resource instanceof Composition ) { final Narrative narrative = ((Composition)resource).getText(); final XhtmlNode html = narrative.getDiv(); final String docText = html.allText(); jCas.setDocumentText( docText );