org.hl7.fhir.dstu3.model.CodeableConcept Java Examples
The following examples show how to use
org.hl7.fhir.dstu3.model.CodeableConcept.
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: BaseWorkerContext.java From org.hl7.fhir.core with Apache License 2.0 | 6 votes |
@SuppressWarnings("rawtypes") private String describeValidationParameters(Parameters pin) { CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder(); for (ParametersParameterComponent p : pin.getParameter()) { if (p.hasValue() && p.getValue() instanceof PrimitiveType) { b.append(p.getName() + "=" + ((PrimitiveType) p.getValue()).asStringValue()); } else if (p.hasValue() && p.getValue() instanceof Coding) { b.append("system=" + ((Coding) p.getValue()).getSystem()); b.append("code=" + ((Coding) p.getValue()).getCode()); b.append("display=" + ((Coding) p.getValue()).getDisplay()); } else if (p.hasValue() && p.getValue() instanceof CodeableConcept) { if (((CodeableConcept) p.getValue()).hasCoding()) { Coding c = ((CodeableConcept) p.getValue()).getCodingFirstRep(); b.append("system=" + c.getSystem()); b.append("code=" + c.getCode()); b.append("display=" + c.getDisplay()); } else if (((CodeableConcept) p.getValue()).hasText()) { b.append("text=" + ((CodeableConcept) p.getValue()).getText()); } } else if (p.hasResource() && (p.getResource() instanceof ValueSet)) { b.append("valueset=" + getVSSummary((ValueSet) p.getResource())); } } return b.toString(); }
Example #2
Source File: ObservationAccessor.java From elexis-3-core with Eclipse Public License 1.0 | 6 votes |
public List<ObservationComponent> getComponents(DomainResource resource){ org.hl7.fhir.dstu3.model.Observation fhirObservation = (org.hl7.fhir.dstu3.model.Observation) resource; List<ObservationComponent> components = new ArrayList<>(); for (ObservationComponentComponent o : fhirObservation.getComponent()) { ObservationComponent component = new ObservationComponent(o.getId()); CodeableConcept codeableConcept = o.getCode(); if (codeableConcept != null) { component.setCoding(ModelUtil.getCodingsFromConcept(codeableConcept)); component.setExtensions(getExtensions(o)); if (o.hasValueQuantity()) { Quantity quantity = (Quantity) o.getValue(); component.setNumericValue(quantity.getValue()); component.setNumericValueUnit(quantity.getUnit()); } else if (o.hasValueStringType()) { StringType stringType = (StringType) o.getValue(); component.setStringValue(stringType.getValue()); } } components.add(component); } return components; }
Example #3
Source File: OperationOutcomeUtilities.java From org.hl7.fhir.core with Apache License 2.0 | 6 votes |
public static OperationOutcomeIssueComponent convertToIssue(ValidationMessage message, OperationOutcome op) { OperationOutcomeIssueComponent issue = new OperationOutcome.OperationOutcomeIssueComponent(); issue.setCode(convert(message.getType())); if (message.getLocation() != null) { // message location has a fhirPath in it. We need to populate the expression issue.addExpression(message.getLocation()); // also, populate the XPath variant StringType s = new StringType(); s.setValue(Utilities.fhirPathToXPath(message.getLocation())+(message.getLine()>= 0 && message.getCol() >= 0 ? " (line "+Integer.toString(message.getLine())+", col"+Integer.toString(message.getCol())+")" : "") ); issue.getLocation().add(s); } issue.setSeverity(convert(message.getLevel())); CodeableConcept c = new CodeableConcept(); c.setText(message.getMessage()); issue.setDetails(c); if (message.getSource() != null) { issue.getExtension().add(ToolingExtensions.makeIssueSource(message.getSource())); } return issue; }
Example #4
Source File: ObservationAccessor.java From elexis-3-core with Eclipse Public License 1.0 | 6 votes |
public void setCategory(DomainResource resource, ObservationCategory category){ org.hl7.fhir.dstu3.model.Observation fhirObservation = (org.hl7.fhir.dstu3.model.Observation) resource; CodeableConcept categoryCode = new CodeableConcept(); if (category.name().startsWith("SOAP_")) { // elexis soap categories categoryCode.setCoding( Collections.singletonList(new Coding(IdentifierSystem.ELEXIS_SOAP.getSystem(), category.getCode(), category.getLocalized()))); } else { org.hl7.fhir.dstu3.model.codesystems.ObservationCategory fhirCategoryCode = (org.hl7.fhir.dstu3.model.codesystems.ObservationCategory) categoryMapping .getFhirEnumValueByEnum(category); if (fhirCategoryCode != null) { // lookup matching fhir category categoryCode .setCoding(Collections.singletonList(new Coding(fhirCategoryCode.getSystem(), fhirCategoryCode.toCode(), fhirCategoryCode.getDisplay()))); } else { throw new IllegalStateException("Unknown observation category " + category); } } if (!categoryCode.getCoding().isEmpty()) { fhirObservation.setCategory(Collections.singletonList(categoryCode)); } }
Example #5
Source File: FindingsFormatUtilTest.java From elexis-3-core with Eclipse Public License 1.0 | 6 votes |
@Test public void convertCondition20() throws IOException { // condition format of HAPI FHIR 2.0 String oldContent = AllTests.getResourceAsString("/rsc/json/ConditionFormat20.json"); assertFalse(FindingsFormatUtil.isCurrentFindingsFormat(oldContent)); Optional<String> newContent = FindingsFormatUtil.convertToCurrentFindingsFormat(oldContent); assertTrue(newContent.isPresent()); IBaseResource resource = AllTests.getJsonParser().parseResource(newContent.get()); assertTrue(resource instanceof Condition); Condition condition = (Condition) resource; // category changed from diagnosis to problem-list-item List<CodeableConcept> category = condition.getCategory(); assertFalse(category.isEmpty()); CodeableConcept code = category.get(0); List<Coding> coding = code.getCoding(); assertFalse(coding.isEmpty()); assertTrue(coding.get(0).getCode().equals(ConditionCategory.PROBLEMLISTITEM.getCode())); // dateRecorded changed to assertedDate Date assertedDate = condition.getAssertedDate(); assertNotNull(assertedDate); }
Example #6
Source File: Convert.java From org.hl7.fhir.core with Apache License 2.0 | 6 votes |
public CodeableConcept makeCodeableConceptFromCD(Element cv) throws Exception { if (cv == null) return null; CodeableConcept cc = new CodeableConcept(); cc.addCoding(makeCodingFromCV(cv)); for (Element e : cda.getChildren(cv, "translation")) cc.addCoding(makeCodingFromCV(e)); if (cda.getChild(cv, "originalText") != null) { Element ote = cda.getChild(cv, "originalText"); // if (cda.getChild(ote, "reference") != null) { // if (cda.getChild(ote, "reference").getAttribute("value").startsWith("#")) { // Element t = cda.getByXmlId(cda.getChild(ote, "reference").getAttribute("value").substring(1)); // String ot = t.getTextContent().trim(); // cc.setText(Utilities.noString(ot) ? null : ot); // } else // throw new Exception("external references not handled yet "+cda.getChild(ote, "reference").getAttribute("value")); // } else { String ot = ote.getTextContent().trim(); cc.setText(Utilities.noString(ot) ? null : ot); //} } return cc; }
Example #7
Source File: Example30_AddSomeExtensions.java From fhirstarters with BSD 3-Clause "New" or "Revised" License | 6 votes |
public static void main(String[] theArgs) { Patient pat = new Patient(); pat.addName().setFamily("Simpson").addGiven("Homer").addGiven("J"); // Add an extension on the resource pat.addExtension() .setUrl("http://hl7.org/fhir/StructureDefinition/patient-importance") .setValue(new CodeableConcept().setText("Patient is a VIP")); // Add an extension on a primitive pat.getBirthDateElement().setValueAsString("1955-02-22"); pat.getBirthDateElement().addExtension() .setUrl("http://hl7.org/fhir/StructureDefinition/patient-birthTime") .setValue(new TimeType("23:30")); IParser parser = FhirContext.forDstu3().newJsonParser().setPrettyPrint(true); System.out.println(parser.encodeResourceToString(pat)); }
Example #8
Source File: ArgonautConverter.java From org.hl7.fhir.core with Apache License 2.0 | 6 votes |
private CodeableConcept inspectCode(CodeableConcept cc, Coding def) { if (cc != null) { for (Coding c : cc.getCoding()) { if ("http://snomed.info/sct".equals(c.getSystem())) { if ("ASSERTION".equals(c.getCode())) c.setSystem("http://hl7.org/fhir/v3/ActCode"); } if ("http://hl7.org/fhir/v3/ActCode".equals(c.getSystem()) && "ASSERTION".equals(c.getCode())) { if (def == null) throw new Error("need a default code"); c.setSystem(def.getSystem()); c.setVersion(def.getVersion()); c.setCode(def.getCode()); c.setDisplay(def.getDisplay()); } } } return cc; }
Example #9
Source File: FhirStu3.java From synthea with Apache License 2.0 | 6 votes |
/** * Helper function to convert a Code into a CodeableConcept. Takes an optional system, which * replaces the Code.system in the resulting CodeableConcept if not null. * * @param from The Code to create a CodeableConcept from. * @param system The system identifier, such as a URI. Optional; may be null. * @return The converted CodeableConcept */ private static CodeableConcept mapCodeToCodeableConcept(Code from, String system) { CodeableConcept to = new CodeableConcept(); system = system == null ? null : ExportHelper.getSystemURI(system); from.system = ExportHelper.getSystemURI(from.system); if (from.display != null) { to.setText(from.display); } Coding coding = new Coding(); coding.setCode(from.code); coding.setDisplay(from.display); if (from.system == null) { coding.setSystem(system); } else { coding.setSystem(from.system); } to.addCoding(coding); return to; }
Example #10
Source File: ArgonautConverter.java From org.hl7.fhir.core with Apache License 2.0 | 6 votes |
private CodeableConcept makeClassCode(CodeableConcept type, DocumentReference ref) throws Exception { CodeableConcept res = new CodeableConcept(); String cs = type.getCoding().get(0).getCode(); if (cs.equals("18842-5") || cs.equals("34133-9")) return type; else if (cs.equals("34111-5")) { ref.getFormatCommentsPre().add("The underlying CDA document has the code '34111-5: Evaluation and Management Note' which is incorrect (wrong display/code combination). The type has been preserved even though it's wrong"); res.addCoding().setSystem("http://loinc.org").setCode("34109-9").setDisplay("Evaluation and management note"); } // else if (cs.equals("34111-5") || cs.equals("5666")) // res.addCoding().setSystem("http://loinc.org").setCode("LP173418-7").setDisplay("Note"); else throw new Exception("Uncategorised document type code: "+cs+": "+type.getCoding().get(0).getDisplay()); return res; }
Example #11
Source File: ArgonautConverter.java From org.hl7.fhir.core with Apache License 2.0 | 6 votes |
private void makeDocumentReference(CDAUtilities cda, Convert convert, Element doc, Context context) throws Exception { scanSection("document", doc); DocumentReference ref = new DocumentReference(); ref.setId(context.baseId+"-document"); ref.setMasterIdentifier(convert.makeIdentifierFromII(cda.getChild(doc, "id"))); ref.setSubject(context.subjectRef); ref.setType(inspectCode(convert.makeCodeableConceptFromCD(cda.getChild(doc, "code")), null)); ref.addAuthor(context.authorRef); ref.setCreatedElement(convert.makeDateTimeFromTS(cda.getChild(doc, "effectiveTime"))); ref.setIndexedElement(InstantType.now()); ref.setStatus(DocumentReferenceStatus.CURRENT); ref.addSecurityLabel(inspectCode(convert.makeCodeableConceptFromCD(cda.getChild(doc, "confidentialityCode")), null)); DocumentReferenceContentComponent cnt = ref.addContent(); cnt.getAttachment().setContentType("application/hl7-v3+xml").setUrl("Binary/"+context.baseId).setLanguage(convertLanguage(cda.getChild(doc, "language"))); // for (Element ti : cda.getChildren(doc, "templateId")) // cnt.addFormat().setSystem("urn:oid:1.3.6.1.4.1.19376.1.2.3").setCode(value)("urn:oid:"+ti.getAttribute("root")); ref.setContext(new DocumentReferenceContextComponent()); ref.getContext().setPeriod(convert.makePeriodFromIVL(cda.getChild(cda.getChild(doc, "serviceEvent"), "effectiveTime"))); for (CodeableConcept cc : context.encounter.getType()) ref.getContext().addEvent(cc); ref.setDescription(cda.getChild(doc, "title").getTextContent()); ref.setCustodian(new Reference().setReference("Organization/"+processOrganization(cda.getDescendent(doc, "custodian/assignedCustodian/representedCustodianOrganization"), cda, convert, context).getId())); Practitioner p = processPerformer(cda, convert, context, cda.getChild(doc, "legalAuthenticator"), "assignedEntity", "assignedPerson"); ref.setAuthenticator(new Reference().setReference("Practitioner/"+p.getId()).setDisplay(p.getUserString("display"))); saveResource(ref); }
Example #12
Source File: FhirStu3.java From synthea with Apache License 2.0 | 5 votes |
/** * Map the given Media element to a FHIR Media resource, and add it to the given Bundle. * * @param personEntry The Entry for the Person * @param bundle Bundle to add the Media to * @param encounterEntry Current Encounter entry * @param obs The Observation to map to FHIR and add to the bundle * @return The added Entry */ private static BundleEntryComponent media(BundleEntryComponent personEntry, Bundle bundle, BundleEntryComponent encounterEntry, Observation obs) { org.hl7.fhir.dstu3.model.Media mediaResource = new org.hl7.fhir.dstu3.model.Media(); if (obs.codes != null && obs.codes.size() > 0) { List<CodeableConcept> reasonList = obs.codes.stream() .map(code -> mapCodeToCodeableConcept(code, SNOMED_URI)).collect(Collectors.toList()); mediaResource.setReasonCode(reasonList); } // Hard code as an image mediaResource.setType(DigitalMediaType.PHOTO); mediaResource.setSubject(new Reference(personEntry.getFullUrl())); Attachment content = (Attachment) obs.value; org.hl7.fhir.dstu3.model.Attachment contentResource = new org.hl7.fhir.dstu3.model.Attachment(); contentResource.setContentType(content.contentType); contentResource.setLanguage(content.language); if (content.data != null) { contentResource.setDataElement(new org.hl7.fhir.dstu3.model.Base64BinaryType(content.data)); } contentResource.setUrl(content.url); contentResource.setSize(content.size); contentResource.setTitle(content.title); if (content.hash != null) { contentResource.setHashElement(new org.hl7.fhir.dstu3.model.Base64BinaryType(content.hash)); } mediaResource.setWidth(content.width); mediaResource.setHeight(content.height); mediaResource.setContent(contentResource); return newEntry(bundle, mediaResource); }
Example #13
Source File: ClaimProcessApp.java From net.jgp.labs.spark with Apache License 2.0 | 5 votes |
@Override public void call(Row r) throws Exception { // Build the claim // --------------- // CLIENT_ID ....... 0 // CLIENT_SUB_ID ... 1 // CLAIM_SK ........ 2 // CLAIM_NBR ....... 3 // CLAIM_ADJ_CD,ADJ_FROM_CLAIM_SK,ADJ_FROM_CLAIM_NBR,ADJ_FROM_CLAIM_ADJ_NBR,CLAIM_STS_CD_SK,CLAIM_STS_CD,SYS_SUBSC_SK,SYS_SUBSC_ID,SYS_MBR_SK,SYS_MBR_ID,CLIENT_HIERARCHY_LVL1,CLIENT_HIERARCHY_LVL2,CLIENT_HIERARCHY_LVL3,CLIENT_HIERARCHY_LVL4,MBR_PCP_SK,MBR_PCP_NBR,PROV_SK,PROV_ID,PROV_TP_CD_SK,PROV_TP_CD,PAYEE_SK,PAYEE_ID,PAYEE_TIN,APPROVE_DAY_AMT,ACTUAL_DAY_AMT,CLAIM_BEG_SVC_DT,RECEIVE_DT,PAY_DT,DRG_CD_SK,DRG_CD,SUBMIT_DRG_CD_SK,SUBMIT_DRG_CD,BILL_CLASS_CD,FACILITY_TP_CD,HOSP_FREQ_CD,ADMIT_SRC_CD_SK,ADMIT_SRC_CD,ADMIT_TP_CD_SK,ADMIT_TP_CD,HOSP_ADMIT_DT,HOSP_ADMIT_HR,HOSP_DISCHARGE_DT,HOSP_DISCHARGE_HR,HOSP_DISCHARGE_STS_CD_SK,HOSP_DISCHARGE_STS_CD,ATTENDING_PROV_SK,ATTENDING_PROV_ID,PROV_ADDR_CD_SK,PROV_ADDR_CD,OOA_IND,EDI_REF_ID,CURRENT_IND,SENSTV_DRG_IND,CLIENT_SPECIFIC_TXT1,CLIENT_SPECIFIC_TXT2,CLIENT_SPECIFIC_TXT3,CLIENT_SPECIFIC_TXT4,CLIENT_SPECIFIC_TXT5,CLIENT_SPECIFIC_TXT6,CLIENT_SPECIFIC_TXT7,CLIENT_SPECIFIC_TXT8,CLIENT_SPECIFIC_TXT9,CLIENT_SPECIFIC_TXT10,REC_LOAD_DTTM,REC_LAST_UPD_DTTM,REC_DEL_IND,DRG_CODE_TP_CD,SUBMIT_DRG_CODE_TP_CD,QA_CURRENT_IND CodeableConcept cc = new CodeableConcept(); cc.setUserData("value", r.getString(3)); // TODO check that this is how // this valued is set here Identifier i = new Identifier(); i.setUse(IdentifierUse.OFFICIAL); i.setType(cc); i.setSystem("Payer Specific Claim Number"); i.setValue(r.getAs("CLAIM_NBR")); // TODO i.setAssigner(value); List<Identifier> identifiers = new ArrayList<>(); identifiers.add(i); Claim c = new Claim(); c.setIdentifier(identifiers); // Process/send the claim // ---------------------- // TODO }
Example #14
Source File: OperationOutcomeFactory.java From careconnect-reference-implementation with Apache License 2.0 | 5 votes |
public static BaseServerResponseException buildOperationOutcomeException(BaseServerResponseException exception, org.hl7.fhir.r4.model.OperationOutcome.IssueType issueType) { org.hl7.fhir.r4.model.CodeableConcept codeableConcept = new org.hl7.fhir.r4.model.CodeableConcept() .setText(exception.getMessage()); org.hl7.fhir.r4.model.OperationOutcome operationOutcome = new org.hl7.fhir.r4.model.OperationOutcome(); operationOutcome.addIssue() .setSeverity(org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity.ERROR) .setCode(issueType) .setDetails(codeableConcept); exception.setOperationOutcome(operationOutcome); return exception; }
Example #15
Source File: LibraryBuilder.java From cqf-ruler with Apache License 2.0 | 5 votes |
public LibraryBuilder buildType(LibraryType libraryType) { CodeableConcept codeableConcept = new CodeableConceptBuilder().buildCoding( new CodingBuilder() .buildCode(libraryType.getSystem(), libraryType.toCode(), libraryType.getDisplay()) .build() ).build(); complexProperty.setType(codeableConcept); return this; }
Example #16
Source File: OperationOutcomeBuilder.java From cqf-ruler with Apache License 2.0 | 5 votes |
public OperationOutcomeBuilder buildIssue(String severity, String code, String details) { complexProperty.addIssue( new OperationOutcome.OperationOutcomeIssueComponent() .setSeverity(OperationOutcome.IssueSeverity.fromCode(severity)) .setCode(OperationOutcome.IssueType.fromCode(code)) .setDetails(new CodeableConcept().setText(details)) ); return this; }
Example #17
Source File: ConditionAccessor.java From elexis-3-core with Eclipse Public License 1.0 | 5 votes |
public void setCategory(DomainResource resource, ConditionCategory category){ org.hl7.fhir.dstu3.model.Condition fhirCondition = (org.hl7.fhir.dstu3.model.Condition) resource; CodeableConcept categoryCode = new CodeableConcept(); org.hl7.fhir.dstu3.model.codesystems.ConditionCategory fhirCategoryCode = (org.hl7.fhir.dstu3.model.codesystems.ConditionCategory) categoryMapping .getFhirEnumValueByEnum(category); if (fhirCategoryCode != null) { categoryCode .setCoding(Collections.singletonList(new Coding(fhirCategoryCode.getSystem(), fhirCategoryCode.toCode(), fhirCategoryCode.getDisplay()))); fhirCondition.setCategory(Collections.singletonList(categoryCode)); } }
Example #18
Source File: ConditionAccessor.java From elexis-3-core with Eclipse Public License 1.0 | 5 votes |
public List<ICoding> getCoding(DomainResource resource){ org.hl7.fhir.dstu3.model.Condition fhirCondition = (org.hl7.fhir.dstu3.model.Condition) resource; CodeableConcept codeableConcept = fhirCondition.getCode(); if (codeableConcept != null) { return ModelUtil.getCodingsFromConcept(codeableConcept); } return Collections.emptyList(); }
Example #19
Source File: AvroConverterTest.java From bunsen with Apache License 2.0 | 5 votes |
@Test public void testContainedResources() throws FHIRException { Medication testMedicationOne = (Medication) testMedicationRequest.getContained().get(0); String testMedicationOneId = testMedicationOne.getId(); CodeableConcept testMedicationIngredientItem = testMedicationOne.getIngredientFirstRep() .getItemCodeableConcept(); Medication decodedMedicationOne = (Medication) testMedicationRequestDecoded.getContained() .get(0); String decodedMedicationOneId = decodedMedicationOne.getId(); CodeableConcept decodedMedicationOneIngredientItem = decodedMedicationOne .getIngredientFirstRep() .getItemCodeableConcept(); Assert.assertEquals(testMedicationOneId, decodedMedicationOneId); Assert.assertTrue(decodedMedicationOneIngredientItem.equalsDeep(testMedicationIngredientItem)); Provenance testProvenance = (Provenance) testMedicationRequest.getContained().get(1); String testProvenanceId = testProvenance.getId(); Provenance decodedProvenance = (Provenance) testMedicationRequestDecoded.getContained().get(1); String decodedProvenanceId = decodedProvenance.getId(); Assert.assertEquals(testProvenanceId, decodedProvenanceId); Medication testMedicationTwo = (Medication) testMedicationRequest.getContained().get(2); String testMedicationTwoId = testMedicationTwo.getId(); Medication decodedMedicationTwo = (Medication) testMedicationRequestDecoded.getContained() .get(2); String decodedMedicationTwoId = decodedMedicationTwo.getId(); Assert.assertEquals(testMedicationTwoId, decodedMedicationTwoId); }
Example #20
Source File: Helper.java From cqf-ruler with Apache License 2.0 | 5 votes |
public static OperationOutcome createErrorOutcome(String display) { Coding code = new Coding().setDisplay(display); return new OperationOutcome().addIssue( new OperationOutcome.OperationOutcomeIssueComponent() .setSeverity(OperationOutcome.IssueSeverity.ERROR) .setCode(OperationOutcome.IssueType.PROCESSING) .setDetails(new CodeableConcept().addCoding(code)) ); }
Example #21
Source File: OperationOutcomeFactory.java From careconnect-reference-implementation with Apache License 2.0 | 5 votes |
public static OperationOutcome createOperationOutcome (String message) { OperationOutcome outcome = new OperationOutcome(); outcome.addIssue() .setCode(OperationOutcome.IssueType.EXCEPTION) .setSeverity(OperationOutcome.IssueSeverity.FATAL) .setDiagnostics(message) .setDetails( new CodeableConcept().setText(message) ); return outcome; }
Example #22
Source File: TranslationRequests.java From careconnect-reference-implementation with Apache License 2.0 | 5 votes |
/** * This is just a convenience method that creates a codeableconcept if one * doesn't already exist, and adds a coding to it */ public TranslationRequests addCode(String theSystem, String theCode) { Validate.notBlank(theSystem, "theSystem must not be null"); Validate.notBlank(theCode, "theCode must not be null"); if (getCodeableConcept() == null) { setCodeableConcept(new CodeableConcept()); } getCodeableConcept().addCoding(new Coding().setSystem(theSystem).setCode(theCode)); return this; }
Example #23
Source File: ProcedureRequest.java From elexis-3-core with Eclipse Public License 1.0 | 5 votes |
@Override public List<ICoding> getCoding(){ Optional<IBaseResource> resource = loadResource(); if (resource.isPresent()) { org.hl7.fhir.dstu3.model.ProcedureRequest fhirProcedureRequest = (org.hl7.fhir.dstu3.model.ProcedureRequest) resource.get(); CodeableConcept codeableConcept = fhirProcedureRequest.getCode(); if (codeableConcept != null) { return ModelUtil.getCodingsFromConcept(codeableConcept); } } return Collections.emptyList(); }
Example #24
Source File: ObservationAccessor.java From elexis-3-core with Eclipse Public License 1.0 | 5 votes |
public List<ICoding> getCoding(DomainResource resource){ org.hl7.fhir.dstu3.model.Observation fhirObservation = (org.hl7.fhir.dstu3.model.Observation) resource; CodeableConcept codeableConcept = fhirObservation.getCode(); if (codeableConcept != null) { return ModelUtil.getCodingsFromConcept(codeableConcept); } return Collections.emptyList(); }
Example #25
Source File: TestData.java From bunsen with Apache License 2.0 | 5 votes |
/** * Returns a new MedicationRequest for testing. * * @return a FHIR MedicationRequest for testing. */ public static MedicationRequest newMedicationRequest() { MedicationRequest medicationRequest = new MedicationRequest(); medicationRequest.setId("test-medication-request"); CodeableConcept itemCodeableConcept = new CodeableConcept(); itemCodeableConcept.addCoding() .setSystem("http://www.nlm.nih.gov/research/umls/rxnorm") .setCode("103109") .setDisplay("Vitamin E 3 MG Oral Tablet [Ephynal]") .setUserSelected(true); medicationRequest.setMedication(itemCodeableConcept); medicationRequest .setSubject(new Reference("Patient/12345").setDisplay("Here is a display for you.")); medicationRequest.setDosageInstruction(ImmutableList.of( new Dosage().setTiming(new Timing().setRepeat(new TimingRepeatComponent().setCount(10))))); medicationRequest .setSubstitution(new MedicationRequestSubstitutionComponent().setAllowed(true)); return medicationRequest; }
Example #26
Source File: TestData.java From bunsen with Apache License 2.0 | 5 votes |
/** * Returns a new Medication for testing. * * @return a FHIR Medication for testing. */ public static Medication newMedication(String id) { Medication medication = new Medication(); medication.setId(id); CodeableConcept itemCodeableConcept = new CodeableConcept(); itemCodeableConcept.addCoding() .setSystem("http://www.nlm.nih.gov/research/umls/rxnorm") .setCode("103109") .setDisplay("Vitamin E 3 MG Oral Tablet [Ephynal]") .setUserSelected(true); MedicationIngredientComponent ingredientComponent = new MedicationIngredientComponent(); ingredientComponent.setItem(itemCodeableConcept); medication.addIngredient(ingredientComponent); Reference itemReference = new Reference("test-item-reference"); MedicationPackageContentComponent medicationPackageContentComponent = new MedicationPackageContentComponent(); medicationPackageContentComponent.setItem(itemReference); MedicationPackageComponent medicationPackageComponent = new MedicationPackageComponent(); medicationPackageComponent.addContent(medicationPackageContentComponent); medication.setPackage(medicationPackageComponent); return medication; }
Example #27
Source File: FhirStu3.java From synthea with Apache License 2.0 | 5 votes |
/** * Map the JsonObject for a Supply into a FHIR SupplyDelivery and add it to the Bundle. * * @param personEntry The Person entry. * @param bundle Bundle to add to. * @param supply The supplied object to add. * @param encounter The encounter during which the supplies were delivered * @return The added Entry. */ private static BundleEntryComponent supplyDelivery(BundleEntryComponent personEntry, Bundle bundle, HealthRecord.Supply supply, Encounter encounter) { SupplyDelivery supplyResource = new SupplyDelivery(); supplyResource.setStatus(SupplyDeliveryStatus.COMPLETED); supplyResource.setPatient(new Reference(personEntry.getFullUrl())); CodeableConcept type = new CodeableConcept(); type.addCoding() .setCode("device") .setDisplay("Device") .setSystem("http://hl7.org/fhir/supply-item-type"); supplyResource.setType(type); SupplyDeliverySuppliedItemComponent suppliedItem = new SupplyDeliverySuppliedItemComponent(); suppliedItem.setItem(mapCodeToCodeableConcept(supply.codes.get(0), SNOMED_URI)); SimpleQuantity quantity = new SimpleQuantity(); quantity.setValue(supply.quantity); suppliedItem.setQuantity(quantity); supplyResource.setSuppliedItem(suppliedItem); supplyResource.setOccurrence(convertFhirDateTime(supply.start, true)); return newEntry(bundle, supplyResource); }
Example #28
Source File: TestData.java From bunsen with Apache License 2.0 | 5 votes |
/** * Returns a new Observation for testing. * * @return a FHIR Observation for testing. */ public static Observation newObservation() { Observation observation = new Observation(); observation.setId("blood-pressure"); Identifier identifier = observation.addIdentifier(); identifier.setSystem("urn:ietf:rfc:3986"); identifier.setValue("urn:uuid:187e0c12-8dd2-67e2-99b2-bf273c878281"); observation.setStatus(Observation.ObservationStatus.FINAL); CodeableConcept obsCode = new CodeableConcept(); observation.setCode(obsCode); Quantity quantity = new Quantity(); quantity.setValue(new java.math.BigDecimal("123.45")); quantity.setUnit("mm[Hg]"); quantity.setSystem("http://unitsofmeasure.org"); observation.setValue(quantity); ObservationComponentComponent component = observation.addComponent(); CodeableConcept code = new CodeableConcept() .addCoding(new Coding() .setCode("abc") .setSystem("PLACEHOLDER")); component.setCode(code); return observation; }
Example #29
Source File: ModelUtil.java From elexis-3-core with Eclipse Public License 1.0 | 5 votes |
public static List<ICoding> getCodingsFromConcept(CodeableConcept codeableConcept){ ArrayList<ICoding> ret = new ArrayList<>(); List<Coding> coding = codeableConcept.getCoding(); for (Coding code : coding) { ret.add(new CodingWrapper(code)); } return ret; }
Example #30
Source File: SparkRowConverterTest.java From bunsen with Apache License 2.0 | 5 votes |
@Test public void testMultiModifierExtensionsWithCodeableConceptField() { CodeableConcept expected1 = (CodeableConcept) testBunsenTestProfilePatient .getModifierExtensionsByUrl(TestData.BUNSEN_TEST_CODEABLE_CONCEPT_MODIFIER_EXT_FIELD) .get(0).getValue(); CodeableConcept expected2 = (CodeableConcept) testBunsenTestProfilePatient .getModifierExtensionsByUrl(TestData.BUNSEN_TEST_CODEABLE_CONCEPT_MODIFIER_EXT_FIELD) .get(1).getValue(); CodeableConcept decodedCodeableConceptField1 = (CodeableConcept) testBunsenTestProfilePatientDecoded .getModifierExtensionsByUrl(TestData.BUNSEN_TEST_CODEABLE_CONCEPT_MODIFIER_EXT_FIELD) .get(0).getValue(); CodeableConcept decodedCodeableConceptField2 = (CodeableConcept) testBunsenTestProfilePatientDecoded .getModifierExtensionsByUrl(TestData.BUNSEN_TEST_CODEABLE_CONCEPT_MODIFIER_EXT_FIELD) .get(1).getValue(); Assert.assertTrue(expected1.equalsDeep(decodedCodeableConceptField1)); Assert.assertTrue(expected2.equalsDeep(decodedCodeableConceptField2)); final List<Row> codings = testBunsenTestProfilePatientDataset .select(functions.explode(functions.col("codeableConceptModifierExt.coding")) .alias("coding")).select("coding.code", "coding.display").collectAsList(); Assert.assertEquals(decodedCodeableConceptField1.getCoding().get(0).getCode(), codings.get(0).getList(0).get(0)); Assert.assertEquals(decodedCodeableConceptField1.getCoding().get(0).getDisplay(), codings.get(0).getList(1).get(0)); Assert.assertEquals(decodedCodeableConceptField2.getCoding().get(0).getCode(), codings.get(1).getList(0).get(0)); Assert.assertEquals(decodedCodeableConceptField2.getCoding().get(0).getDisplay(), codings.get(1).getList(1).get(0)); }