use of org.hl7.fhir.dstu3.model.Coding in project gpconnect-demonstrator by nhsconnect.
the class PatientResourceProvider method setStaticPatientData.
private Patient setStaticPatientData(Patient patient) {
patient.setLanguage(("en-GB"));
patient.addExtension(createCodingExtension("CG", "Greek Cypriot", SystemURL.CS_CC_ETHNIC_CATEGORY, SystemURL.SD_CC_EXT_ETHNIC_CATEGORY));
patient.addExtension(createCodingExtension("SomeSnomedCode", "Some Snomed Code", SystemURL.CS_CC_RELIGIOUS_AFFILI, SystemURL.SD_CC_EXT_RELIGIOUS_AFFILI));
patient.addExtension(new Extension(SystemURL.SD_PATIENT_CADAVERIC_DON, new BooleanType(false)));
patient.addExtension(createCodingExtension("H", "UK Resident", SystemURL.CS_CC_RESIDENTIAL_STATUS, SystemURL.SD_CC_EXT_RESIDENTIAL_STATUS));
patient.addExtension(createCodingExtension("3", "To pay hotel fees only", SystemURL.CS_CC_TREATMENT_CAT, SystemURL.SD_CC_EXT_TREATMENT_CAT));
Extension nhsCommExtension = new Extension();
nhsCommExtension.setUrl(SystemURL.SD_CC_EXT_NHS_COMMUNICATION);
nhsCommExtension.addExtension(createCodingExtension("en", "English", SystemURL.CS_CC_HUMAN_LANG, SystemURL.SD_CC_EXT_COMM_LANGUAGE));
nhsCommExtension.addExtension(new Extension(SystemURL.SD_CC_COMM_PREFERRED, new BooleanType(false)));
nhsCommExtension.addExtension(createCodingExtension("RWR", "Received written", SystemURL.CS_CC_LANG_ABILITY_MODE, SystemURL.SD_CC_MODE_OF_COMM));
nhsCommExtension.addExtension(createCodingExtension("E", "Excellent", SystemURL.CS_CC_LANG_ABILITY_PROFI, SystemURL.SD_CC_COMM_PROFICIENCY));
nhsCommExtension.addExtension(new Extension(SystemURL.SD_CC_INTERPRETER_REQUIRED, new BooleanType(false)));
patient.addExtension(nhsCommExtension);
Identifier localIdentifier = new Identifier();
localIdentifier.setUse(IdentifierUse.USUAL);
localIdentifier.setSystem(SystemURL.ID_LOCAL_PATIENT_IDENTIFIER);
localIdentifier.setValue("123456");
CodeableConcept liType = new CodeableConcept();
Coding liTypeCoding = new Coding();
liTypeCoding.setCode("EN");
liTypeCoding.setDisplay("Employer number");
liTypeCoding.setSystem(SystemURL.VS_IDENTIFIER_TYPE);
liType.addCoding(liTypeCoding);
localIdentifier.setType(liType);
localIdentifier.setAssigner(new Reference("Organization/1"));
patient.addIdentifier(localIdentifier);
Calendar calendar = Calendar.getInstance();
calendar.set(2017, 1, 1);
DateTimeDt endDate = new DateTimeDt(calendar.getTime());
calendar.set(2016, 1, 1);
DateTimeDt startDate = new DateTimeDt(calendar.getTime());
Period pastPeriod = new Period().setStart(calendar.getTime()).setEnd(calendar.getTime());
patient.addName().setFamily("AnotherOfficialFamilyName").addGiven("AnotherOfficialGivenName").setUse(NameUse.OFFICIAL).setPeriod(pastPeriod);
patient.addName().setFamily("AdditionalFamily").addGiven("AdditionalGiven").setUse(NameUse.TEMP);
patient.addTelecom(staticElHelper.getValidTelecom());
patient.addAddress(staticElHelper.getValidAddress());
return patient;
}
use of org.hl7.fhir.dstu3.model.Coding in project gpconnect-demonstrator by nhsconnect.
the class PatientResourceProvider method createCoding.
private CodeableConcept createCoding(String code, String display, String vsSystem) {
Coding coding = new Coding();
coding.setCode(code);
coding.setDisplay(display);
coding.setSystem(vsSystem);
CodeableConcept concept = new CodeableConcept();
concept.addCoding(coding);
return concept;
}
use of org.hl7.fhir.dstu3.model.Coding in project gpconnect-demonstrator by nhsconnect.
the class PractitionerResourceProvider method practitionerDetailsToPractitionerResourceConverter.
private Practitioner practitionerDetailsToPractitionerResourceConverter(PractitionerDetails practitionerDetails) {
Identifier identifier = new Identifier().setSystem(SystemURL.ID_SDS_USER_ID).setValue(practitionerDetails.getUserId());
Practitioner practitioner = new Practitioner().addIdentifier(identifier);
practitionerDetails.getRoleIds().stream().distinct().map(roleId -> new Identifier().setSystem(SystemURL.ID_SDS_ROLE_PROFILE_ID).setValue(roleId)).forEach(practitioner::addIdentifier);
String resourceId = String.valueOf(practitionerDetails.getId());
String versionId = String.valueOf(practitionerDetails.getLastUpdated().getTime());
String resourceType = practitioner.getResourceType().toString();
IdType id = new IdType(resourceType, resourceId, versionId);
practitioner.setId(id);
practitioner.getMeta().setVersionId(versionId);
practitioner.getMeta().setLastUpdated(practitionerDetails.getLastUpdated());
practitioner.getMeta().addProfile(SystemURL.SD_GPC_PRACTITIONER);
HumanName name = new HumanName().setFamily(practitionerDetails.getNameFamily()).addGiven(practitionerDetails.getNameGiven()).addPrefix(practitionerDetails.getNamePrefix()).setUse(NameUse.USUAL);
practitioner.addName(name);
switch(practitionerDetails.getGender().toLowerCase(Locale.UK)) {
case "male":
practitioner.setGender(AdministrativeGender.MALE);
break;
case "female":
practitioner.setGender(AdministrativeGender.FEMALE);
break;
case "other":
practitioner.setGender(AdministrativeGender.OTHER);
break;
default:
practitioner.setGender(AdministrativeGender.UNKNOWN);
break;
}
Coding roleCoding = new Coding(SystemURL.VS_SDS_JOB_ROLE_NAME, practitionerDetails.getRoleCode(), practitionerDetails.getRoleDisplay());
for (int i = 0; i < practitionerDetails.getComCode().size(); i++) {
Coding comCoding = new Coding(SystemURL.VS_HUMAN_LANGUAGE, practitionerDetails.getComCode().get(i), null).setDisplay(practitionerDetails.getComDisplay().get(i));
practitioner.addCommunication().addCoding(comCoding);
}
return practitioner;
}
use of org.hl7.fhir.dstu3.model.Coding in project loinc2hpo by monarch-initiative.
the class ObservationAnalysisFromInterpretation method getHPOforObservation.
@Override
public HpoTermId4LoincTest getHPOforObservation() throws UnsupportedCodingSystemException, AmbiguousResultsFoundException, AnnotationNotFoundException, UnrecognizedCodeException {
// here we use a map to store the results: since there could be more than one interpretation coding system,
// we try them all and store the results in a map <external code, result in internal code>
Map<Code, Code> results = new HashMap<>();
// get the annotation class for this loinc code
UniversalLoinc2HPOAnnotation annotationForLoinc = annotationMap.get(this.loincId);
if (annotationForLoinc == null)
throw new AnnotationNotFoundException();
// all interpretation codes in different coding systems. Expect one in most cases.
Set<Code> interpretationCodes = getInterpretationCodes();
interpretationCodes.stream().filter(p -> CodeSystemConvertor.getCodeContainer().getCodeSystemMap().containsKey(p.getSystem())).forEach(p -> {
Code internalCode = null;
try {
internalCode = CodeSystemConvertor.convertToInternalCode(p);
results.put(p, internalCode);
} catch (InternalCodeNotFoundException e) {
e.printStackTrace();
}
});
List<Code> distinct = results.values().stream().distinct().collect(Collectors.toList());
if (distinct.size() == 1) {
HpoTermId4LoincTest hpoTermId4LoincTest = annotationForLoinc.loincInterpretationToHPO(distinct.get(0));
if (hpoTermId4LoincTest == null)
throw new UnrecognizedCodeException();
return hpoTermId4LoincTest;
} else {
throw new AmbiguousResultsFoundException();
}
}
use of org.hl7.fhir.dstu3.model.Coding in project loinc2hpo by monarch-initiative.
the class CodeSystemInternal method init.
@Override
protected void init() {
final Coding BELOWNORMAL = new Coding(INTERNALSYSTEM, "L", "below normal range");
final Coding NORMAL = new Coding(INTERNALSYSTEM, "N", "within normal range");
final Coding ABOVENORMAL = new Coding(INTERNALSYSTEM, "H", "above normal range");
final Coding ABSENCE = new Coding(INTERNALSYSTEM, "NP", "not present");
final Coding PRESENCE = new Coding(INTERNALSYSTEM, "P", "present");
final Coding UNKNOWN = new Coding(INTERNALSYSTEM, "unknown", "unknown");
codes.put(BELOWNORMAL.getCode(), BELOWNORMAL);
codes.put(NORMAL.getCode(), NORMAL);
codes.put(ABOVENORMAL.getCode(), ABOVENORMAL);
codes.put(ABSENCE.getCode(), ABSENCE);
codes.put(PRESENCE.getCode(), PRESENCE);
codes.put(UNKNOWN.getCode(), UNKNOWN);
}
Aggregations