From 8ee5be3b7652a773b83ae538e2158e79c71a03e3 Mon Sep 17 00:00:00 2001 From: Bob Zhao Date: Tue, 14 Nov 2023 11:08:29 -0500 Subject: [PATCH] fix tests --- .../api/converter/FhirConverter.java | 2712 +++++++++-------- .../api/model/TestEventExport.java | 6 +- .../api/converter/FhirConverterTest.java | 17 +- backend/src/test/resources/fhir/bundle.json | 9 + .../bundles-upload-integration-testing.ndjson | 55 +- backend/src/test/resources/fhir/specimen.json | 8 +- .../fhir-for-csv-with-comments.ndjson | 22 +- .../fhir-for-csv-with-flu-only.ndjson | 11 +- ...hir-for-csv-with-specimenType-loinc.ndjson | 22 +- .../test-results-upload-valid-as-fhir.json | 11 +- .../test-results-upload-valid-as-fhir.ndjson | 12 +- 11 files changed, 1504 insertions(+), 1381 deletions(-) diff --git a/backend/src/main/java/gov/cdc/usds/simplereport/api/converter/FhirConverter.java b/backend/src/main/java/gov/cdc/usds/simplereport/api/converter/FhirConverter.java index 609089e4f6f..9f79debede8 100644 --- a/backend/src/main/java/gov/cdc/usds/simplereport/api/converter/FhirConverter.java +++ b/backend/src/main/java/gov/cdc/usds/simplereport/api/converter/FhirConverter.java @@ -58,6 +58,8 @@ import static gov.cdc.usds.simplereport.api.converter.FhirConstants.TRIBAL_AFFILIATION_STRING; import static gov.cdc.usds.simplereport.api.converter.FhirConstants.UNIVERSAL_ID_SYSTEM; import static gov.cdc.usds.simplereport.api.converter.FhirConstants.YESNO_CODE_SYSTEM; +import static gov.cdc.usds.simplereport.api.model.TestEventExport.DEFAULT_LOCATION_CODE; +import static gov.cdc.usds.simplereport.api.model.TestEventExport.DEFAULT_LOCATION_NAME; import static gov.cdc.usds.simplereport.api.model.TestEventExport.FALLBACK_DEFAULT_TEST_MINUTES; import static gov.cdc.usds.simplereport.api.model.TestEventExport.UNKNOWN_ADDRESS_INDICATOR; import static gov.cdc.usds.simplereport.db.model.PersonUtils.getResidenceTypeMap; @@ -93,6 +95,7 @@ import gov.cdc.usds.simplereport.utils.MultiplexUtils; import gov.cdc.usds.simplereport.utils.UUIDGenerator; import jakarta.validation.constraints.NotNull; + import java.time.Duration; import java.time.LocalDate; import java.time.ZoneId; @@ -110,6 +113,7 @@ import java.util.TimeZone; import java.util.UUID; import java.util.function.Function; + import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; @@ -162,1360 +166,1364 @@ @RequiredArgsConstructor public class FhirConverter { - private final UUIDGenerator uuidGenerator; - private final DateGenerator dateGenerator; + private final UUIDGenerator uuidGenerator; + private final DateGenerator dateGenerator; + + private static final String SIMPLE_REPORT_ORG_ID = "07640c5d-87cd-488b-9343-a226c5166539"; + + public HumanName convertToHumanName(@NotNull PersonName personName) { + return convertToHumanName( + personName.getFirstName(), + personName.getMiddleName(), + personName.getLastName(), + personName.getSuffix()); + } + + public HumanName convertToHumanName(String first, String middle, String last, String suffix) { + var humanName = new HumanName(); + if (StringUtils.isNotBlank(first)) { + humanName.addGiven(first); + } + if (StringUtils.isNotBlank(middle)) { + humanName.addGiven(middle); + } + if (StringUtils.isNotBlank(last)) { + humanName.setFamily(last); + } + if (StringUtils.isNotBlank(suffix)) { + humanName.addSuffix(suffix); + } + return humanName; + } + + public List convertPhoneNumbersToContactPoint( + @NotNull List phoneNumber) { + return phoneNumber.stream().map(this::convertToContactPoint).toList(); + } + + public ContactPoint convertToContactPoint(@NotNull PhoneNumber phoneNumber) { + var contactPointUse = ContactPointUse.HOME; + if (PhoneType.MOBILE.equals(phoneNumber.getType())) { + contactPointUse = ContactPointUse.MOBILE; + } + + return convertToContactPoint(contactPointUse, phoneNumber.getNumber()); + } + + public ContactPoint convertToContactPoint(ContactPointUse contactPointUse, String number) { + // converting string to phone format as recommended by the fhir format. + // https://www.hl7.org/fhir/datatypes.html#ContactPoint + try { + var phoneUtil = PhoneNumberUtil.getInstance(); + var parsedNumber = phoneUtil.parse(number, "US"); + var formattedWithDash = phoneUtil.format(parsedNumber, PhoneNumberFormat.NATIONAL); + + number = formattedWithDash.replace("-", " "); + } catch (NumberParseException exception) { + log.debug("Error parsing number: " + exception); + } + + return convertToContactPoint(contactPointUse, ContactPointSystem.PHONE, number); + } + + public List convertEmailsToContactPoint(ContactPointUse use, List emails) { + return emails.stream().map(email -> convertEmailToContactPoint(use, email)).toList(); + } + + public ContactPoint convertEmailToContactPoint(ContactPointUse use, @NotNull String email) { + return convertToContactPoint(use, ContactPointSystem.EMAIL, email); + } + + public ContactPoint convertToContactPoint( + ContactPointUse use, ContactPointSystem system, String value) { + return new ContactPoint().setUse(use).setSystem(system).setValue(value); + } + + public AdministrativeGender convertToAdministrativeGender(String gender) { + + if (gender == null) { + return AdministrativeGender.UNKNOWN; + } + + return switch (gender.toLowerCase()) { + case "male", "m" -> AdministrativeGender.MALE; + case "female", "f" -> AdministrativeGender.FEMALE; + default -> AdministrativeGender.UNKNOWN; + }; + } + + public Date convertToDate(@NotNull LocalDate date) { + return Date.from(date.atStartOfDay(ZoneId.systemDefault()).toInstant()); + } + + /** + * @param zonedDateTime the date time with a time zone + * @return the DateTimeType object created from the ZonedDateTime, it's timezone, and second + * temporal precision + */ + public DateTimeType convertToDateTimeType(ZonedDateTime zonedDateTime) { + return convertToDateTimeType(zonedDateTime, TemporalPrecisionEnum.SECOND); + } + + /** + * @param zonedDateTime the date time with a time zone + * @param temporalPrecisionEnum precision of the date time, defaults to {@code + * TemporalPrecisionEnum.SECOND} + * @return the DateTimeType object created from the ZonedDateTime and it's timezone + */ + public DateTimeType convertToDateTimeType( + ZonedDateTime zonedDateTime, TemporalPrecisionEnum temporalPrecisionEnum) { + if (zonedDateTime == null) { + return null; + } + if (temporalPrecisionEnum == null) { + temporalPrecisionEnum = TemporalPrecisionEnum.SECOND; + } + return new DateTimeType( + Date.from(zonedDateTime.toInstant()), + temporalPrecisionEnum, + TimeZone.getTimeZone(zonedDateTime.getZone())); + } + + /** + * @param zonedDateTime the date time with a time zone + * @param temporalPrecisionEnum precision of the date time, defaults to {@code + * TemporalPrecisionEnum.MILLI} + * @return the InstantType object created from the Instant of the ZonedDateTime and its time zone + * offset + */ + public InstantType convertToInstantType( + ZonedDateTime zonedDateTime, TemporalPrecisionEnum temporalPrecisionEnum) { + if (zonedDateTime == null) return null; + if (temporalPrecisionEnum == null) temporalPrecisionEnum = TemporalPrecisionEnum.MILLI; + return new InstantType( + Date.from(zonedDateTime.toInstant()), + temporalPrecisionEnum, + TimeZone.getTimeZone(zonedDateTime.getZone())); + } + + public Address convertToAddress(@NotNull StreetAddress address, String country) { + return convertToAddress( + address.getStreet(), + address.getCity(), + address.getCounty(), + address.getState(), + address.getPostalCode(), + country); + } + + public Address convertToAddress( + List street, + String city, + String county, + String state, + String postalCode, + String country) { + var address = + new Address() + .setCity(city) + .setDistrict(county) + .setState(state) + .setPostalCode(postalCode) + .setCountry(country); + if (street != null) { + street.forEach(address::addLine); + } + return address; + } + + public Extension convertToRaceExtension(@NotNull String race) { + var ext = new Extension(); + ext.setUrl(RACE_EXTENSION_URL); + var codeable = new CodeableConcept(); + var coding = codeable.addCoding(); + String raceKey = race.toLowerCase(); + if (StringUtils.isNotBlank(race) && PersonUtils.raceMap.containsKey(raceKey)) { + if (MappingConstants.UNKNOWN_STRING.equalsIgnoreCase(race) + || "refused".equalsIgnoreCase(race)) { + coding.setSystem(NULL_CODE_SYSTEM); + } else { + coding.setSystem(RACE_CODING_SYSTEM); + } + coding.setCode(PersonUtils.raceMap.get(raceKey)); + codeable.setText(race); + } else { + coding.setSystem(NULL_CODE_SYSTEM); + coding.setCode(MappingConstants.UNK_CODE); + codeable.setText(MappingConstants.UNKNOWN_STRING); + } + ext.setValue(codeable); + return ext; + } + + public Extension convertToEthnicityExtension(String ethnicity) { + if (StringUtils.isNotBlank(ethnicity)) { + var ext = new Extension(); + ext.setUrl(ETHNICITY_EXTENSION_URL); + var codeableConcept = new CodeableConcept(); + var coding = codeableConcept.addCoding().setSystem(ETHNICITY_CODE_SYSTEM); + String ethnicityKey = ethnicity.toLowerCase(); + if (PersonUtils.ETHNICITY_MAP.containsKey(ethnicityKey)) { + coding + .setCode(PersonUtils.ETHNICITY_MAP.get(ethnicityKey).get(0)) + .setDisplay(PersonUtils.ETHNICITY_MAP.get(ethnicityKey).get(1)); + codeableConcept.setText(PersonUtils.ETHNICITY_MAP.get(ethnicityKey).get(1)); + } else { + coding.setCode(MappingConstants.U_CODE).setDisplay(MappingConstants.UNKNOWN_STRING); + codeableConcept.setText(MappingConstants.UNKNOWN_STRING); + } + ext.setValue(codeableConcept); + return ext; + } + return null; + } + + public Optional convertToTribalAffiliationExtension(List tribalAffiliations) { + return CollectionUtils.isEmpty(tribalAffiliations) + ? Optional.empty() + : convertToTribalAffiliationExtension(tribalAffiliations.get(0)); + } + + public Optional convertToTribalAffiliationExtension(String tribalAffiliation) { + if (StringUtils.isNotBlank(tribalAffiliation)) { + var ext = new Extension(); + ext.setUrl(TRIBAL_AFFILIATION_EXTENSION_URL); + var tribeExtension = ext.addExtension(); + tribeExtension.setUrl(TRIBAL_AFFILIATION_STRING); + var tribeCodeableConcept = new CodeableConcept(); + var tribeCoding = tribeCodeableConcept.addCoding(); + tribeCoding.setSystem(TRIBAL_AFFILIATION_CODE_SYSTEM); + tribeCoding.setCode(tribalAffiliation); + tribeCoding.setDisplay(PersonUtils.tribalMap().get(tribalAffiliation)); + tribeCodeableConcept.setText(PersonUtils.tribalMap().get(tribalAffiliation)); + tribeExtension.setValue(tribeCodeableConcept); + return Optional.of(ext); + } + return Optional.empty(); + } + + public Practitioner convertToPractitioner(Provider provider) { + return convertToPractitioner( + provider.getInternalId().toString(), + provider.getNameInfo(), + provider.getTelephone(), + provider.getAddress(), + DEFAULT_COUNTRY, + provider.getProviderId()); + } + + public Practitioner convertToPractitioner( + String id, + PersonName name, + String telephone, + StreetAddress addr, + String country, + String npi) { + var practitioner = + new Practitioner() + .addName(convertToHumanName(name)) + .addAddress(convertToAddress(addr, country)) + .addTelecom(convertToContactPoint(ContactPointUse.WORK, telephone)); + practitioner.setId(id); + + LuhnCheckDigit npiValidator = new LuhnCheckDigit(); + if (StringUtils.isNotEmpty(npi) && npiValidator.isValid(NPI_PREFIX.concat(npi))) { + practitioner.addIdentifier().setSystem(PRACTICIONER_IDENTIFIER_SYSTEM).setValue(npi); + } + + return practitioner; + } + + public Organization convertToOrganization(Facility facility) { + return convertToOrganization( + facility.getInternalId().toString(), + facility.getFacilityName(), + facility.getCliaNumber(), + facility.getTelephone(), + facility.getEmail(), + facility.getAddress(), + DEFAULT_COUNTRY); + } + + public Organization convertToOrganization( + String id, + String name, + String clia, + String telephone, + String email, + StreetAddress addr, + String country) { + var org = + new Organization() + .setName(name) + .addAddress(convertToAddress(addr, country)) + .addTelecom(convertToContactPoint(ContactPointUse.WORK, telephone)); + + org.addIdentifier() + .setUse(IdentifierUse.OFFICIAL) + .setValue(clia) + .getType() + .addCoding() + .setSystem(UNIVERSAL_ID_SYSTEM) + .setCode("CLIA"); + + if (email != null && !email.isBlank()) { + org.addTelecom(convertEmailToContactPoint(ContactPointUse.WORK, email)); + } + org.setId(id); + return org; + } + + public StreetAddress getPatientAddress(Person person, Facility facility) { + var personAddress = person.getAddress(); + if (UNKNOWN_ADDRESS_INDICATOR.equalsIgnoreCase(person.getStreet()) && facility != null) { + var facilityAddress = facility.getAddress(); + personAddress.setCity(facilityAddress.getCity()); + personAddress.setState(facilityAddress.getState()); + personAddress.setPostalCode(facilityAddress.getPostalCode()); + personAddress.setCounty(facilityAddress.getCounty()); + } + return personAddress; + } + + public List getPatientPhoneNumbers(Person person, Facility facility) { + if (person.getPhoneNumbers() == null || person.getPhoneNumbers().isEmpty()) { + return List.of(new PhoneNumber(PhoneType.LANDLINE, facility.getTelephone())); + } + return person.getPhoneNumbers(); + } + + public Patient convertToPatient(Person person, Facility facility) { + return convertToPatient( + ConvertToPatientProps.builder() + .id(person.getInternalId().toString()) + .name(person.getNameInfo()) + .phoneNumbers(getPatientPhoneNumbers(person, facility)) + .emails(person.getEmails()) + .gender(person.getGender()) + .genderIdentity(person.getGenderIdentity()) + .dob(person.getBirthDate()) + .address(getPatientAddress(person, facility)) + .country(person.getCountry()) + .race(person.getRace()) + .ethnicity(person.getEthnicity()) + .tribalAffiliations(person.getTribalAffiliation()) + .build()); + } + + public Patient convertToPatient(ConvertToPatientProps props) { + var patient = + new Patient() + .addName(convertToHumanName(props.getName())) + .setGender(convertToAdministrativeGender(props.getGender())) + .setBirthDate(convertToDate(props.getDob())) + .addAddress(convertToAddress(props.getAddress(), props.getCountry())); + + patient.addExtension(convertToRaceExtension(props.getRace())); + patient.addExtension(convertToEthnicityExtension(props.getEthnicity())); + patient.addExtension( + convertToTribalAffiliationExtension(props.getTribalAffiliations()).orElse(null)); + + patient.addExtension(convertToGenderIdentityExtension(props.getGenderIdentity())); + + patient.setId(props.getId()); + patient.addIdentifier().setValue(props.getId()); + + if (!CollectionUtils.isEmpty(props.getPhoneNumbers())) { + convertPhoneNumbersToContactPoint(props.getPhoneNumbers()).forEach(patient::addTelecom); + } + + if (!CollectionUtils.isEmpty(props.getEmails())) { + convertEmailsToContactPoint(ContactPointUse.HOME, props.getEmails()) + .forEach(patient::addTelecom); + } + return patient; + } + + private Extension convertToGenderIdentityExtension(String genderIdentity) { + if (StringUtils.isNotBlank(genderIdentity)) { + + Map extensionValueSet = + Map.of( + FEMALE, "female", + MALE, "male", + NON_BINARY, "non-binary", + TRANS_MAN, "transgender male", + TRANS_WOMAN, "transgender female", + OTHER, "other", + REFUSED, "non-disclose"); + + Map extensionDisplaySet = + Map.of( + FEMALE, "female", + MALE, "male", + NON_BINARY, "non-binary", + TRANS_MAN, "transgender male", + TRANS_WOMAN, "transgender female", + OTHER, "other", + REFUSED, "does not wish to disclose"); + + String genderIdentityKey = genderIdentity.toLowerCase(); + + var codeableConcept = + new CodeableConcept() + .addCoding() + .setSystem(GENDER_IDENTITY_EXTENSION_CODE_SYSTEM) + .setCode(extensionValueSet.get(genderIdentityKey)) + .setDisplay(extensionDisplaySet.get(genderIdentityKey)); + + return new Extension().setUrl(GENDER_IDENTITY_EXTENSION_URL).setValue(codeableConcept); + } + return null; + } + + public Device convertToDevice( + @NotNull DeviceType deviceType, String equipmentUid, String equipmentUidType) { + return convertToDevice( + deviceType.getManufacturer(), + deviceType.getModel(), + deviceType.getInternalId().toString(), + equipmentUid, + equipmentUidType); + } + + public Device convertToDevice( + String manufacturer, + @NotNull String model, + String id, + String equipmentUid, + String equipmentUidType) { + var device = + new Device() + .addDeviceName( + new DeviceDeviceNameComponent().setName(model).setType(DeviceNameType.MODELNAME)); + if (StringUtils.isNotBlank(equipmentUid)) { + device.addIdentifier().setValue(equipmentUid); + } + if (StringUtils.isNotBlank(equipmentUidType)) { + CodeableConcept equipmentUidTypeCodeableConcept = new CodeableConcept(); + Coding equipmentUidTypeCoding = equipmentUidTypeCodeableConcept.addCoding(); + equipmentUidTypeCoding.setCode(equipmentUidType); + + device.addIdentifier().setType(equipmentUidTypeCodeableConcept); + } + if (StringUtils.isNotBlank(manufacturer)) { + device.setManufacturer(manufacturer); + } + + device.setId(id); + return device; + } + + public Specimen convertToSpecimen(ConvertToSpecimenProps props) { + var specimen = new Specimen(); + specimen.setId(props.getId()); + specimen.addIdentifier().setValue(props.getIdentifier()); + + var collection = specimen.getCollection(); + var collectionCodeableConcept = collection.getBodySite(); + var collectionCoding = collectionCodeableConcept.addCoding(); + collectionCoding.setSystem(SNOMED_CODE_SYSTEM); + collectionCoding.setCode( + Optional.of(props) + .map(ConvertToSpecimenProps::getCollectionCode) + .orElse(DEFAULT_LOCATION_CODE)); + collectionCodeableConcept.setText( + Optional.of(props) + .map(ConvertToSpecimenProps::getCollectionName) + .orElse(DEFAULT_LOCATION_NAME)); + + if (StringUtils.isNotBlank(props.getSpecimenCode())) { + var codeableConcept = specimen.getType(); + var coding = codeableConcept.addCoding(); + coding.setSystem(SNOMED_CODE_SYSTEM); + coding.setCode(props.getSpecimenCode()); + codeableConcept.setText(props.getSpecimenName()); + } + if (props.getCollectionDate() != null) { + collection.setCollected(convertToDateTimeType(props.getCollectionDate())); + } + + if (props.getReceivedTime() != null) { + specimen.setReceivedTimeElement(convertToDateTimeType(props.getReceivedTime())); + } + + return specimen; + } + + public Specimen convertToSpecimen( + @NotNull SpecimenType specimenType, + UUID specimenIdentifier, + ZonedDateTime collectionDate, + ZonedDateTime receivedTime) { + return convertToSpecimen( + ConvertToSpecimenProps.builder() + .specimenCode(specimenType.getTypeCode()) + .specimenName(specimenType.getName()) + .collectionCode(specimenType.getCollectionLocationCode()) + .collectionName(specimenType.getCollectionLocationName()) + .id(specimenType.getInternalId().toString()) + .identifier(specimenIdentifier.toString()) + .collectionDate(collectionDate) + .receivedTime(receivedTime) + .build()); + } + + public List convertToObservation( + Set results, + DeviceType deviceType, + TestCorrectionStatus correctionStatus, + String correctionReason, + Date resultDate) { + return results.stream() + .map( + result -> { + List deviceTypeDiseaseEntries = + deviceType.getSupportedDiseaseTestPerformed().stream() + .filter(code -> code.getSupportedDisease().equals(result.getDisease())) + .toList(); + String testPerformedLoincCode = + deviceTypeDiseaseEntries.stream() + .findFirst() + .map(DeviceTypeDisease::getTestPerformedLoincCode) + .orElse(null); + String testkitNameId = + getCommonDiseaseValue( + deviceTypeDiseaseEntries, DeviceTypeDisease::getTestkitNameId); + return convertToObservation( + result, + testPerformedLoincCode, + correctionStatus, + correctionReason, + testkitNameId, + deviceType.getModel(), + resultDate); + }) + .toList(); + } + + public String getCommonDiseaseValue( + List deviceTypeDiseases, + Function diseaseValue) { + List distinctValues = deviceTypeDiseases.stream().map(diseaseValue).distinct().toList(); + return distinctValues.size() == 1 ? distinctValues.get(0) : null; + } + + public Observation convertToObservation( + Result result, + String testPerformedCode, + TestCorrectionStatus correctionStatus, + String correctionReason, + String testkitNameId, + String deviceModel, + Date resultDate) { + if (result != null && result.getDisease() != null) { + + return convertToObservation( + ConvertToObservationProps.builder() + .diseaseCode(testPerformedCode) + .diseaseName(result.getDisease().getName()) + .resultCode(result.getResultSNOMED()) + .correctionStatus(correctionStatus) + .correctionReason(correctionReason) + .id(result.getInternalId().toString()) + .resultDescription( + Translators.convertConceptCodeToConceptName(result.getResultSNOMED())) + .testkitNameId(testkitNameId) + .deviceModel(deviceModel) + .issued(resultDate) + .build()); + } + return null; + } + + public Observation convertToObservation(ConvertToObservationProps props) { + var observation = new Observation(); + observation.setId(props.getId()); + setStatus(observation, props.getCorrectionStatus()); + observation.setCode(createLoincConcept(props.getDiseaseCode(), "", props.getDiseaseName())); + addSNOMEDValue(props.getResultCode(), observation, props.getResultDescription()); + observation.getMethod().getCodingFirstRep().setDisplay(props.getDeviceModel()); + observation + .getMethod() + .addExtension( + new Extension() + .setUrl(TESTKIT_NAME_ID_EXTENSION_URL) + .setValue(new CodeableConcept().addCoding().setCode(props.getTestkitNameId()))); + + addCorrectionNote( + props.getCorrectionStatus() != TestCorrectionStatus.ORIGINAL, + props.getCorrectionReason(), + observation); + + observation + .addInterpretation() + .addCoding(convertToAbnormalFlagInterpretation(props.getResultCode())); + + observation.setIssued(props.getIssued()); + observation.getIssuedElement().setTimeZoneZulu(true); + + return observation; + } + + private Coding convertToAbnormalFlagInterpretation(String resultCode) { + Coding abnormalFlag = new Coding(); + + abnormalFlag.setSystem(ABNORMAL_FLAGS_CODE_SYSTEM); + + if (resultCode.equals(DETECTED_SNOMED_CONCEPT.code())) { + abnormalFlag.setCode(ABNORMAL_FLAG_ABNORMAL.code()); + abnormalFlag.setDisplay(ABNORMAL_FLAG_ABNORMAL.displayName()); + } else { + abnormalFlag.setCode(ABNORMAL_FLAG_NORMAL.code()); + abnormalFlag.setDisplay(ABNORMAL_FLAG_NORMAL.displayName()); + } + + return abnormalFlag; + } + + private void setStatus(Observation observation, TestCorrectionStatus correctionStatus) { + switch (correctionStatus) { + case ORIGINAL: + observation.setStatus(ObservationStatus.FINAL); + break; + case CORRECTED: + observation.setStatus(ObservationStatus.CORRECTED); + break; + case REMOVED: + observation.setStatus(ObservationStatus.ENTEREDINERROR); + break; + } + } + + private void addCorrectionNote( + boolean corrected, String correctionReason, Observation observation) { + if (corrected) { + var annotation = observation.addNote(); + var correctedNote = "Corrected Result"; + if (StringUtils.isNotBlank(correctionReason)) { + correctedNote += ": " + correctionReason; + } + annotation.setText(correctedNote); + } + } + + public Set convertToAOESymptomObservation( + String eventId, Boolean symptomatic, LocalDate symptomOnsetDate) { + var observations = new LinkedHashSet(); + var symptomaticCode = + createLoincConcept( + LOINC_AOE_SYMPTOMATIC, + "Has symptoms related to condition of interest", + "Has symptoms related to condition of interest"); + observations.add( + createAOEObservation( + eventId + LOINC_AOE_SYMPTOMATIC, symptomaticCode, createYesNoUnkConcept(symptomatic))); + + if (Boolean.TRUE.equals(symptomatic) && symptomOnsetDate != null) { + observations.add( + createAOEObservation( + eventId + LOINC_AOE_SYMPTOM_ONSET, + createLoincConcept( + LOINC_AOE_SYMPTOM_ONSET, + "Illness or injury onset date and time", + "Illness or injury onset date and time"), + new DateTimeType(symptomOnsetDate.toString()))); + } + return observations; + } + + public Observation convertToAOEPregnancyObservation(String pregnancyStatusSnomed) { + String pregnancyStatusDisplay = pregnancyStatusDisplayMap.get(pregnancyStatusSnomed); + CodeableConcept pregnancyStatusCode = + createLoincConcept(LOINC_AOE_PREGNANCY_STATUS, "Pregnancy status", "Pregnancy status"); + CodeableConcept pregnancyStatusValueCode = + createSNOMEDConcept(pregnancyStatusSnomed, pregnancyStatusDisplay); + return createAOEObservation( + uuidGenerator.randomUUID() + LOINC_AOE_PREGNANCY_STATUS, + pregnancyStatusCode, + pregnancyStatusValueCode); + } + + public Observation convertToAOEYesNoUnkObservation( + Boolean isObserved, String observationLoinc, String observationDisplayText) { + CodeableConcept observationCode = + createLoincConcept(observationLoinc, observationDisplayText, observationDisplayText); + return createAOEObservation( + uuidGenerator.randomUUID() + observationLoinc, + observationCode, + createYesNoUnkConcept(isObserved)); + } + + public Set convertToAOEResidenceObservation( + Boolean residesInCongregateSetting, String residenceTypeSnomed) { + HashSet observations = new LinkedHashSet<>(); + + observations.add( + convertToAOEYesNoUnkObservation( + residesInCongregateSetting, + LOINC_AOE_RESIDENT_CONGREGATE_SETTING, + "Resides in a congregate care setting")); + + if (Boolean.TRUE.equals(residesInCongregateSetting) + && StringUtils.isNotBlank(residenceTypeSnomed)) { + + CodeableConcept residenceTypeCode = + createLoincConcept(LOINC_AOE_RESIDENCE_TYPE, "Residence", "Residence"); + String residenceTypeTextDisplay = getResidenceTypeMap().get(residenceTypeSnomed); + observations.add( + createAOEObservation( + uuidGenerator.randomUUID() + LOINC_AOE_RESIDENCE_TYPE, + residenceTypeCode, + createSNOMEDConcept(residenceTypeSnomed, residenceTypeTextDisplay))); + } + return observations; + } + + public Set convertToAOEObservations( + String eventId, + AskOnEntrySurvey surveyData, + Boolean employedInHealthcare, + Boolean residesInCongregateSetting) { + HashSet observations = new LinkedHashSet<>(); + Boolean symptomatic = null; + if (Boolean.TRUE.equals(surveyData.getNoSymptoms())) { + symptomatic = false; + } else if (surveyData.getSymptoms().containsValue(Boolean.TRUE)) { + symptomatic = true; + } // implied else: AoE form was not completed. Symptomatic set to null + + var symptomOnsetDate = surveyData.getSymptomOnsetDate(); + observations.addAll(convertToAOESymptomObservation(eventId, symptomatic, symptomOnsetDate)); + + String pregnancyStatus = surveyData.getPregnancy(); + if (pregnancyStatus != null && pregnancyStatusSnomedMap.values().contains(pregnancyStatus)) { + observations.add(convertToAOEPregnancyObservation(surveyData.getPregnancy())); + } + + if (employedInHealthcare != null) { + observations.add( + convertToAOEYesNoUnkObservation( + employedInHealthcare, + LOINC_AOE_EMPLOYED_IN_HEALTHCARE, + AOE_EMPLOYED_IN_HEALTHCARE_DISPLAY)); + } + + if (residesInCongregateSetting != null) { + observations.addAll(convertToAOEResidenceObservation(residesInCongregateSetting, null)); + } + + return observations; + } + + public Observation createAOEObservation(String uniqueName, CodeableConcept code, Type value) { + var observation = + new Observation().setStatus(ObservationStatus.FINAL).setCode(code).setValue(value); + observation.setId(UUID.nameUUIDFromBytes(uniqueName.getBytes()).toString()); + + observation + .addIdentifier() + .setUse(IdentifierUse.OFFICIAL) + .setType( + createLoincConcept( + LOINC_AOE_IDENTIFIER, "Public health laboratory ask at order entry panel", null)); + + return observation; + } + + private CodeableConcept createLoincConcept(String codingCode, String codingDisplay, String text) { + var concept = new CodeableConcept().setText(text); - private static final String SIMPLE_REPORT_ORG_ID = "07640c5d-87cd-488b-9343-a226c5166539"; + concept.addCoding().setSystem(LOINC_CODE_SYSTEM).setCode(codingCode).setDisplay(codingDisplay); - public HumanName convertToHumanName(@NotNull PersonName personName) { - return convertToHumanName( - personName.getFirstName(), - personName.getMiddleName(), - personName.getLastName(), - personName.getSuffix()); - } + return concept; + } + + private CodeableConcept createYesNoUnkConcept(Boolean val) { + var concept = new CodeableConcept(); + var coding = concept.addCoding(); + if (val == null) { + coding + .setSystem(NULL_CODE_SYSTEM) + .setCode(MappingConstants.UNK_CODE) + .setDisplay(MappingConstants.UNKNOWN_STRING); + } else { + coding.setSystem(YESNO_CODE_SYSTEM).setCode(val ? "Y" : "N").setDisplay(val ? "Yes" : "No"); + } + return concept; + } + + private CodeableConcept createSNOMEDConcept(String resultCode, String resultDisplay) { + CodeableConcept concept = new CodeableConcept(); + Coding coding = concept.addCoding(); + coding.setSystem(SNOMED_CODE_SYSTEM); + coding.setCode(resultCode); + if (StringUtils.isNotBlank(resultDisplay)) { + coding.setDisplay(resultDisplay); + } + return concept; + } + + private void addSNOMEDValue(String resultCode, Observation observation, String resultDisplay) { + var valueCodeableConcept = createSNOMEDConcept(resultCode, resultDisplay); + observation.setValue(valueCodeableConcept); + } + + private static int getTestDuration(TestEvent testEvent) { + return Optional.ofNullable(testEvent.getDeviceType()) + .map(DeviceType::getTestLength) + .orElse(FALLBACK_DEFAULT_TEST_MINUTES); + } - public HumanName convertToHumanName(String first, String middle, String last, String suffix) { - var humanName = new HumanName(); - if (StringUtils.isNotBlank(first)) { - humanName.addGiven(first); - } - if (StringUtils.isNotBlank(middle)) { - humanName.addGiven(middle); - } - if (StringUtils.isNotBlank(last)) { - humanName.setFamily(last); - } - if (StringUtils.isNotBlank(suffix)) { - humanName.addSuffix(suffix); - } - return humanName; - } - - public List convertPhoneNumbersToContactPoint( - @NotNull List phoneNumber) { - return phoneNumber.stream().map(this::convertToContactPoint).toList(); - } - - public ContactPoint convertToContactPoint(@NotNull PhoneNumber phoneNumber) { - var contactPointUse = ContactPointUse.HOME; - if (PhoneType.MOBILE.equals(phoneNumber.getType())) { - contactPointUse = ContactPointUse.MOBILE; - } - - return convertToContactPoint(contactPointUse, phoneNumber.getNumber()); - } - - public ContactPoint convertToContactPoint(ContactPointUse contactPointUse, String number) { - // converting string to phone format as recommended by the fhir format. - // https://www.hl7.org/fhir/datatypes.html#ContactPoint - try { - var phoneUtil = PhoneNumberUtil.getInstance(); - var parsedNumber = phoneUtil.parse(number, "US"); - var formattedWithDash = phoneUtil.format(parsedNumber, PhoneNumberFormat.NATIONAL); - - number = formattedWithDash.replace("-", " "); - } catch (NumberParseException exception) { - log.debug("Error parsing number: " + exception); - } - - return convertToContactPoint(contactPointUse, ContactPointSystem.PHONE, number); - } - - public List convertEmailsToContactPoint(ContactPointUse use, List emails) { - return emails.stream().map(email -> convertEmailToContactPoint(use, email)).toList(); - } - - public ContactPoint convertEmailToContactPoint(ContactPointUse use, @NotNull String email) { - return convertToContactPoint(use, ContactPointSystem.EMAIL, email); - } - - public ContactPoint convertToContactPoint( - ContactPointUse use, ContactPointSystem system, String value) { - return new ContactPoint().setUse(use).setSystem(system).setValue(value); - } - - public AdministrativeGender convertToAdministrativeGender(String gender) { - - if (gender == null) { - return AdministrativeGender.UNKNOWN; - } - - return switch (gender.toLowerCase()) { - case "male", "m" -> AdministrativeGender.MALE; - case "female", "f" -> AdministrativeGender.FEMALE; - default -> AdministrativeGender.UNKNOWN; - }; - } - - public Date convertToDate(@NotNull LocalDate date) { - return Date.from(date.atStartOfDay(ZoneId.systemDefault()).toInstant()); - } - - /** - * @param zonedDateTime the date time with a time zone - * @return the DateTimeType object created from the ZonedDateTime, it's timezone, and second - * temporal precision - */ - public DateTimeType convertToDateTimeType(ZonedDateTime zonedDateTime) { - return convertToDateTimeType(zonedDateTime, TemporalPrecisionEnum.SECOND); - } - - /** - * @param zonedDateTime the date time with a time zone - * @param temporalPrecisionEnum precision of the date time, defaults to {@code - * TemporalPrecisionEnum.SECOND} - * @return the DateTimeType object created from the ZonedDateTime and it's timezone - */ - public DateTimeType convertToDateTimeType( - ZonedDateTime zonedDateTime, TemporalPrecisionEnum temporalPrecisionEnum) { - if (zonedDateTime == null) { - return null; - } - if (temporalPrecisionEnum == null) { - temporalPrecisionEnum = TemporalPrecisionEnum.SECOND; - } - return new DateTimeType( - Date.from(zonedDateTime.toInstant()), - temporalPrecisionEnum, - TimeZone.getTimeZone(zonedDateTime.getZone())); - } - - /** - * @param zonedDateTime the date time with a time zone - * @param temporalPrecisionEnum precision of the date time, defaults to {@code - * TemporalPrecisionEnum.MILLI} - * @return the InstantType object created from the Instant of the ZonedDateTime and its time zone - * offset - */ - public InstantType convertToInstantType( - ZonedDateTime zonedDateTime, TemporalPrecisionEnum temporalPrecisionEnum) { - if (zonedDateTime == null) return null; - if (temporalPrecisionEnum == null) temporalPrecisionEnum = TemporalPrecisionEnum.MILLI; - return new InstantType( - Date.from(zonedDateTime.toInstant()), - temporalPrecisionEnum, - TimeZone.getTimeZone(zonedDateTime.getZone())); - } - - public Address convertToAddress(@NotNull StreetAddress address, String country) { - return convertToAddress( - address.getStreet(), - address.getCity(), - address.getCounty(), - address.getState(), - address.getPostalCode(), - country); - } - - public Address convertToAddress( - List street, - String city, - String county, - String state, - String postalCode, - String country) { - var address = - new Address() - .setCity(city) - .setDistrict(county) - .setState(state) - .setPostalCode(postalCode) - .setCountry(country); - if (street != null) { - street.forEach(address::addLine); - } - return address; - } - - public Extension convertToRaceExtension(@NotNull String race) { - var ext = new Extension(); - ext.setUrl(RACE_EXTENSION_URL); - var codeable = new CodeableConcept(); - var coding = codeable.addCoding(); - String raceKey = race.toLowerCase(); - if (StringUtils.isNotBlank(race) && PersonUtils.raceMap.containsKey(raceKey)) { - if (MappingConstants.UNKNOWN_STRING.equalsIgnoreCase(race) - || "refused".equalsIgnoreCase(race)) { - coding.setSystem(NULL_CODE_SYSTEM); - } else { - coding.setSystem(RACE_CODING_SYSTEM); - } - coding.setCode(PersonUtils.raceMap.get(raceKey)); - codeable.setText(race); - } else { - coding.setSystem(NULL_CODE_SYSTEM); - coding.setCode(MappingConstants.UNK_CODE); - codeable.setText(MappingConstants.UNKNOWN_STRING); - } - ext.setValue(codeable); - return ext; - } - - public Extension convertToEthnicityExtension(String ethnicity) { - if (StringUtils.isNotBlank(ethnicity)) { - var ext = new Extension(); - ext.setUrl(ETHNICITY_EXTENSION_URL); - var codeableConcept = new CodeableConcept(); - var coding = codeableConcept.addCoding().setSystem(ETHNICITY_CODE_SYSTEM); - String ethnicityKey = ethnicity.toLowerCase(); - if (PersonUtils.ETHNICITY_MAP.containsKey(ethnicityKey)) { - coding - .setCode(PersonUtils.ETHNICITY_MAP.get(ethnicityKey).get(0)) - .setDisplay(PersonUtils.ETHNICITY_MAP.get(ethnicityKey).get(1)); - codeableConcept.setText(PersonUtils.ETHNICITY_MAP.get(ethnicityKey).get(1)); - } else { - coding.setCode(MappingConstants.U_CODE).setDisplay(MappingConstants.UNKNOWN_STRING); - codeableConcept.setText(MappingConstants.UNKNOWN_STRING); - } - ext.setValue(codeableConcept); - return ext; - } - return null; - } - - public Optional convertToTribalAffiliationExtension(List tribalAffiliations) { - return CollectionUtils.isEmpty(tribalAffiliations) - ? Optional.empty() - : convertToTribalAffiliationExtension(tribalAffiliations.get(0)); - } - - public Optional convertToTribalAffiliationExtension(String tribalAffiliation) { - if (StringUtils.isNotBlank(tribalAffiliation)) { - var ext = new Extension(); - ext.setUrl(TRIBAL_AFFILIATION_EXTENSION_URL); - var tribeExtension = ext.addExtension(); - tribeExtension.setUrl(TRIBAL_AFFILIATION_STRING); - var tribeCodeableConcept = new CodeableConcept(); - var tribeCoding = tribeCodeableConcept.addCoding(); - tribeCoding.setSystem(TRIBAL_AFFILIATION_CODE_SYSTEM); - tribeCoding.setCode(tribalAffiliation); - tribeCoding.setDisplay(PersonUtils.tribalMap().get(tribalAffiliation)); - tribeCodeableConcept.setText(PersonUtils.tribalMap().get(tribalAffiliation)); - tribeExtension.setValue(tribeCodeableConcept); - return Optional.of(ext); - } - return Optional.empty(); - } - - public Practitioner convertToPractitioner(Provider provider) { - return convertToPractitioner( - provider.getInternalId().toString(), - provider.getNameInfo(), - provider.getTelephone(), - provider.getAddress(), - DEFAULT_COUNTRY, - provider.getProviderId()); - } - - public Practitioner convertToPractitioner( - String id, - PersonName name, - String telephone, - StreetAddress addr, - String country, - String npi) { - var practitioner = - new Practitioner() - .addName(convertToHumanName(name)) - .addAddress(convertToAddress(addr, country)) - .addTelecom(convertToContactPoint(ContactPointUse.WORK, telephone)); - practitioner.setId(id); - - LuhnCheckDigit npiValidator = new LuhnCheckDigit(); - if (StringUtils.isNotEmpty(npi) && npiValidator.isValid(NPI_PREFIX.concat(npi))) { - practitioner.addIdentifier().setSystem(PRACTICIONER_IDENTIFIER_SYSTEM).setValue(npi); - } - - return practitioner; - } - - public Organization convertToOrganization(Facility facility) { - return convertToOrganization( - facility.getInternalId().toString(), - facility.getFacilityName(), - facility.getCliaNumber(), - facility.getTelephone(), - facility.getEmail(), - facility.getAddress(), - DEFAULT_COUNTRY); - } - - public Organization convertToOrganization( - String id, - String name, - String clia, - String telephone, - String email, - StreetAddress addr, - String country) { - var org = - new Organization() - .setName(name) - .addAddress(convertToAddress(addr, country)) - .addTelecom(convertToContactPoint(ContactPointUse.WORK, telephone)); - - org.addIdentifier() - .setUse(IdentifierUse.OFFICIAL) - .setValue(clia) - .getType() - .addCoding() - .setSystem(UNIVERSAL_ID_SYSTEM) - .setCode("CLIA"); - - if (email != null && !email.isBlank()) { - org.addTelecom(convertEmailToContactPoint(ContactPointUse.WORK, email)); - } - org.setId(id); - return org; - } - - public StreetAddress getPatientAddress(Person person, Facility facility) { - var personAddress = person.getAddress(); - if (UNKNOWN_ADDRESS_INDICATOR.equalsIgnoreCase(person.getStreet()) && facility != null) { - var facilityAddress = facility.getAddress(); - personAddress.setCity(facilityAddress.getCity()); - personAddress.setState(facilityAddress.getState()); - personAddress.setPostalCode(facilityAddress.getPostalCode()); - personAddress.setCounty(facilityAddress.getCounty()); - } - return personAddress; - } - - public List getPatientPhoneNumbers(Person person, Facility facility) { - if (person.getPhoneNumbers() == null || person.getPhoneNumbers().isEmpty()) { - return List.of(new PhoneNumber(PhoneType.LANDLINE, facility.getTelephone())); - } - return person.getPhoneNumbers(); - } - - public Patient convertToPatient(Person person, Facility facility) { - return convertToPatient( - ConvertToPatientProps.builder() - .id(person.getInternalId().toString()) - .name(person.getNameInfo()) - .phoneNumbers(getPatientPhoneNumbers(person, facility)) - .emails(person.getEmails()) - .gender(person.getGender()) - .genderIdentity(person.getGenderIdentity()) - .dob(person.getBirthDate()) - .address(getPatientAddress(person, facility)) - .country(person.getCountry()) - .race(person.getRace()) - .ethnicity(person.getEthnicity()) - .tribalAffiliations(person.getTribalAffiliation()) - .build()); - } - - public Patient convertToPatient(ConvertToPatientProps props) { - var patient = - new Patient() - .addName(convertToHumanName(props.getName())) - .setGender(convertToAdministrativeGender(props.getGender())) - .setBirthDate(convertToDate(props.getDob())) - .addAddress(convertToAddress(props.getAddress(), props.getCountry())); - - patient.addExtension(convertToRaceExtension(props.getRace())); - patient.addExtension(convertToEthnicityExtension(props.getEthnicity())); - patient.addExtension( - convertToTribalAffiliationExtension(props.getTribalAffiliations()).orElse(null)); - - patient.addExtension(convertToGenderIdentityExtension(props.getGenderIdentity())); - - patient.setId(props.getId()); - patient.addIdentifier().setValue(props.getId()); - - if (!CollectionUtils.isEmpty(props.getPhoneNumbers())) { - convertPhoneNumbersToContactPoint(props.getPhoneNumbers()).forEach(patient::addTelecom); - } - - if (!CollectionUtils.isEmpty(props.getEmails())) { - convertEmailsToContactPoint(ContactPointUse.HOME, props.getEmails()) - .forEach(patient::addTelecom); - } - return patient; - } - - private Extension convertToGenderIdentityExtension(String genderIdentity) { - if (StringUtils.isNotBlank(genderIdentity)) { - - Map extensionValueSet = - Map.of( - FEMALE, "female", - MALE, "male", - NON_BINARY, "non-binary", - TRANS_MAN, "transgender male", - TRANS_WOMAN, "transgender female", - OTHER, "other", - REFUSED, "non-disclose"); - - Map extensionDisplaySet = - Map.of( - FEMALE, "female", - MALE, "male", - NON_BINARY, "non-binary", - TRANS_MAN, "transgender male", - TRANS_WOMAN, "transgender female", - OTHER, "other", - REFUSED, "does not wish to disclose"); - - String genderIdentityKey = genderIdentity.toLowerCase(); - - var codeableConcept = - new CodeableConcept() - .addCoding() - .setSystem(GENDER_IDENTITY_EXTENSION_CODE_SYSTEM) - .setCode(extensionValueSet.get(genderIdentityKey)) - .setDisplay(extensionDisplaySet.get(genderIdentityKey)); - - return new Extension().setUrl(GENDER_IDENTITY_EXTENSION_URL).setValue(codeableConcept); - } - return null; - } - - public Device convertToDevice( - @NotNull DeviceType deviceType, String equipmentUid, String equipmentUidType) { - return convertToDevice( - deviceType.getManufacturer(), - deviceType.getModel(), - deviceType.getInternalId().toString(), - equipmentUid, - equipmentUidType); - } - - public Device convertToDevice( - String manufacturer, - @NotNull String model, - String id, - String equipmentUid, - String equipmentUidType) { - var device = - new Device() - .addDeviceName( - new DeviceDeviceNameComponent().setName(model).setType(DeviceNameType.MODELNAME)); - if (StringUtils.isNotBlank(equipmentUid)) { - device.addIdentifier().setValue(equipmentUid); - } - if (StringUtils.isNotBlank(equipmentUidType)) { - CodeableConcept equipmentUidTypeCodeableConcept = new CodeableConcept(); - Coding equipmentUidTypeCoding = equipmentUidTypeCodeableConcept.addCoding(); - equipmentUidTypeCoding.setCode(equipmentUidType); - - device.addIdentifier().setType(equipmentUidTypeCodeableConcept); - } - if (StringUtils.isNotBlank(manufacturer)) { - device.setManufacturer(manufacturer); - } - - device.setId(id); - return device; - } - - public Specimen convertToSpecimen(ConvertToSpecimenProps props) { - var specimen = new Specimen(); - specimen.setId(props.getId()); - specimen.addIdentifier().setValue(props.getIdentifier()); - if (StringUtils.isNotBlank(props.getSpecimenCode())) { - var codeableConcept = specimen.getType(); - var coding = codeableConcept.addCoding(); - coding.setSystem(SNOMED_CODE_SYSTEM); - coding.setCode(props.getSpecimenCode()); - codeableConcept.setText(props.getSpecimenName()); - } - if (StringUtils.isNotBlank(props.getCollectionCode())) { - var collection = specimen.getCollection(); - var codeableConcept = collection.getBodySite(); - var coding = codeableConcept.addCoding(); - coding.setSystem(SNOMED_CODE_SYSTEM); - coding.setCode(props.getCollectionCode()); - codeableConcept.setText(props.getCollectionName()); - } - - if (props.getCollectionDate() != null) { - var collection = specimen.getCollection(); - collection.setCollected(convertToDateTimeType(props.getCollectionDate())); - } - - if (props.getReceivedTime() != null) { - specimen.setReceivedTimeElement(convertToDateTimeType(props.getReceivedTime())); - } - - return specimen; - } - - public Specimen convertToSpecimen( - @NotNull SpecimenType specimenType, - UUID specimenIdentifier, - ZonedDateTime collectionDate, - ZonedDateTime receivedTime) { - return convertToSpecimen( - ConvertToSpecimenProps.builder() - .specimenCode(specimenType.getTypeCode()) - .specimenName(specimenType.getName()) - .collectionCode(specimenType.getCollectionLocationCode()) - .collectionName(specimenType.getCollectionLocationName()) - .id(specimenType.getInternalId().toString()) - .identifier(specimenIdentifier.toString()) - .collectionDate(collectionDate) - .receivedTime(receivedTime) - .build()); - } - - public List convertToObservation( - Set results, - DeviceType deviceType, - TestCorrectionStatus correctionStatus, - String correctionReason, - Date resultDate) { - return results.stream() - .map( - result -> { - List deviceTypeDiseaseEntries = - deviceType.getSupportedDiseaseTestPerformed().stream() - .filter(code -> code.getSupportedDisease().equals(result.getDisease())) - .toList(); - String testPerformedLoincCode = - deviceTypeDiseaseEntries.stream() - .findFirst() - .map(DeviceTypeDisease::getTestPerformedLoincCode) - .orElse(null); - String testkitNameId = - getCommonDiseaseValue( - deviceTypeDiseaseEntries, DeviceTypeDisease::getTestkitNameId); - return convertToObservation( - result, - testPerformedLoincCode, - correctionStatus, - correctionReason, - testkitNameId, - deviceType.getModel(), - resultDate); - }) - .toList(); - } - - public String getCommonDiseaseValue( - List deviceTypeDiseases, - Function diseaseValue) { - List distinctValues = deviceTypeDiseases.stream().map(diseaseValue).distinct().toList(); - return distinctValues.size() == 1 ? distinctValues.get(0) : null; - } - - public Observation convertToObservation( - Result result, - String testPerformedCode, - TestCorrectionStatus correctionStatus, - String correctionReason, - String testkitNameId, - String deviceModel, - Date resultDate) { - if (result != null && result.getDisease() != null) { - - return convertToObservation( - ConvertToObservationProps.builder() - .diseaseCode(testPerformedCode) - .diseaseName(result.getDisease().getName()) - .resultCode(result.getResultSNOMED()) - .correctionStatus(correctionStatus) - .correctionReason(correctionReason) - .id(result.getInternalId().toString()) - .resultDescription( - Translators.convertConceptCodeToConceptName(result.getResultSNOMED())) - .testkitNameId(testkitNameId) - .deviceModel(deviceModel) - .issued(resultDate) - .build()); - } - return null; - } - - public Observation convertToObservation(ConvertToObservationProps props) { - var observation = new Observation(); - observation.setId(props.getId()); - setStatus(observation, props.getCorrectionStatus()); - observation.setCode(createLoincConcept(props.getDiseaseCode(), "", props.getDiseaseName())); - addSNOMEDValue(props.getResultCode(), observation, props.getResultDescription()); - observation.getMethod().getCodingFirstRep().setDisplay(props.getDeviceModel()); - observation - .getMethod() - .addExtension( - new Extension() - .setUrl(TESTKIT_NAME_ID_EXTENSION_URL) - .setValue(new CodeableConcept().addCoding().setCode(props.getTestkitNameId()))); - - addCorrectionNote( - props.getCorrectionStatus() != TestCorrectionStatus.ORIGINAL, - props.getCorrectionReason(), - observation); - - observation - .addInterpretation() - .addCoding(convertToAbnormalFlagInterpretation(props.getResultCode())); - - observation.setIssued(props.getIssued()); - observation.getIssuedElement().setTimeZoneZulu(true); - - return observation; - } - - private Coding convertToAbnormalFlagInterpretation(String resultCode) { - Coding abnormalFlag = new Coding(); - - abnormalFlag.setSystem(ABNORMAL_FLAGS_CODE_SYSTEM); - - if (resultCode.equals(DETECTED_SNOMED_CONCEPT.code())) { - abnormalFlag.setCode(ABNORMAL_FLAG_ABNORMAL.code()); - abnormalFlag.setDisplay(ABNORMAL_FLAG_ABNORMAL.displayName()); - } else { - abnormalFlag.setCode(ABNORMAL_FLAG_NORMAL.code()); - abnormalFlag.setDisplay(ABNORMAL_FLAG_NORMAL.displayName()); - } - - return abnormalFlag; - } - - private void setStatus(Observation observation, TestCorrectionStatus correctionStatus) { - switch (correctionStatus) { - case ORIGINAL: - observation.setStatus(ObservationStatus.FINAL); - break; - case CORRECTED: - observation.setStatus(ObservationStatus.CORRECTED); - break; - case REMOVED: - observation.setStatus(ObservationStatus.ENTEREDINERROR); - break; - } - } - - private void addCorrectionNote( - boolean corrected, String correctionReason, Observation observation) { - if (corrected) { - var annotation = observation.addNote(); - var correctedNote = "Corrected Result"; - if (StringUtils.isNotBlank(correctionReason)) { - correctedNote += ": " + correctionReason; - } - annotation.setText(correctedNote); - } - } - - public Set convertToAOESymptomObservation( - String eventId, Boolean symptomatic, LocalDate symptomOnsetDate) { - var observations = new LinkedHashSet(); - var symptomaticCode = - createLoincConcept( - LOINC_AOE_SYMPTOMATIC, - "Has symptoms related to condition of interest", - "Has symptoms related to condition of interest"); - observations.add( - createAOEObservation( - eventId + LOINC_AOE_SYMPTOMATIC, symptomaticCode, createYesNoUnkConcept(symptomatic))); - - if (Boolean.TRUE.equals(symptomatic) && symptomOnsetDate != null) { - observations.add( - createAOEObservation( - eventId + LOINC_AOE_SYMPTOM_ONSET, - createLoincConcept( - LOINC_AOE_SYMPTOM_ONSET, - "Illness or injury onset date and time", - "Illness or injury onset date and time"), - new DateTimeType(symptomOnsetDate.toString()))); - } - return observations; - } - - public Observation convertToAOEPregnancyObservation(String pregnancyStatusSnomed) { - String pregnancyStatusDisplay = pregnancyStatusDisplayMap.get(pregnancyStatusSnomed); - CodeableConcept pregnancyStatusCode = - createLoincConcept(LOINC_AOE_PREGNANCY_STATUS, "Pregnancy status", "Pregnancy status"); - CodeableConcept pregnancyStatusValueCode = - createSNOMEDConcept(pregnancyStatusSnomed, pregnancyStatusDisplay); - return createAOEObservation( - uuidGenerator.randomUUID() + LOINC_AOE_PREGNANCY_STATUS, - pregnancyStatusCode, - pregnancyStatusValueCode); - } - - public Observation convertToAOEYesNoUnkObservation( - Boolean isObserved, String observationLoinc, String observationDisplayText) { - CodeableConcept observationCode = - createLoincConcept(observationLoinc, observationDisplayText, observationDisplayText); - return createAOEObservation( - uuidGenerator.randomUUID() + observationLoinc, - observationCode, - createYesNoUnkConcept(isObserved)); - } - - public Set convertToAOEResidenceObservation( - Boolean residesInCongregateSetting, String residenceTypeSnomed) { - HashSet observations = new LinkedHashSet<>(); - - observations.add( - convertToAOEYesNoUnkObservation( - residesInCongregateSetting, - LOINC_AOE_RESIDENT_CONGREGATE_SETTING, - "Resides in a congregate care setting")); - - if (Boolean.TRUE.equals(residesInCongregateSetting) - && StringUtils.isNotBlank(residenceTypeSnomed)) { - - CodeableConcept residenceTypeCode = - createLoincConcept(LOINC_AOE_RESIDENCE_TYPE, "Residence", "Residence"); - String residenceTypeTextDisplay = getResidenceTypeMap().get(residenceTypeSnomed); - observations.add( - createAOEObservation( - uuidGenerator.randomUUID() + LOINC_AOE_RESIDENCE_TYPE, - residenceTypeCode, - createSNOMEDConcept(residenceTypeSnomed, residenceTypeTextDisplay))); - } - return observations; - } - - public Set convertToAOEObservations( - String eventId, - AskOnEntrySurvey surveyData, - Boolean employedInHealthcare, - Boolean residesInCongregateSetting) { - HashSet observations = new LinkedHashSet<>(); - Boolean symptomatic = null; - if (Boolean.TRUE.equals(surveyData.getNoSymptoms())) { - symptomatic = false; - } else if (surveyData.getSymptoms().containsValue(Boolean.TRUE)) { - symptomatic = true; - } // implied else: AoE form was not completed. Symptomatic set to null - - var symptomOnsetDate = surveyData.getSymptomOnsetDate(); - observations.addAll(convertToAOESymptomObservation(eventId, symptomatic, symptomOnsetDate)); - - String pregnancyStatus = surveyData.getPregnancy(); - if (pregnancyStatus != null && pregnancyStatusSnomedMap.values().contains(pregnancyStatus)) { - observations.add(convertToAOEPregnancyObservation(surveyData.getPregnancy())); - } - - if (employedInHealthcare != null) { - observations.add( - convertToAOEYesNoUnkObservation( - employedInHealthcare, - LOINC_AOE_EMPLOYED_IN_HEALTHCARE, - AOE_EMPLOYED_IN_HEALTHCARE_DISPLAY)); - } - - if (residesInCongregateSetting != null) { - observations.addAll(convertToAOEResidenceObservation(residesInCongregateSetting, null)); - } - - return observations; - } - - public Observation createAOEObservation(String uniqueName, CodeableConcept code, Type value) { - var observation = - new Observation().setStatus(ObservationStatus.FINAL).setCode(code).setValue(value); - observation.setId(UUID.nameUUIDFromBytes(uniqueName.getBytes()).toString()); - - observation - .addIdentifier() - .setUse(IdentifierUse.OFFICIAL) - .setType( - createLoincConcept( - LOINC_AOE_IDENTIFIER, "Public health laboratory ask at order entry panel", null)); - - return observation; - } - - private CodeableConcept createLoincConcept(String codingCode, String codingDisplay, String text) { - var concept = new CodeableConcept().setText(text); - - concept.addCoding().setSystem(LOINC_CODE_SYSTEM).setCode(codingCode).setDisplay(codingDisplay); - - return concept; - } - - private CodeableConcept createYesNoUnkConcept(Boolean val) { - var concept = new CodeableConcept(); - var coding = concept.addCoding(); - if (val == null) { - coding - .setSystem(NULL_CODE_SYSTEM) - .setCode(MappingConstants.UNK_CODE) - .setDisplay(MappingConstants.UNKNOWN_STRING); - } else { - coding.setSystem(YESNO_CODE_SYSTEM).setCode(val ? "Y" : "N").setDisplay(val ? "Yes" : "No"); - } - return concept; - } - - private CodeableConcept createSNOMEDConcept(String resultCode, String resultDisplay) { - CodeableConcept concept = new CodeableConcept(); - Coding coding = concept.addCoding(); - coding.setSystem(SNOMED_CODE_SYSTEM); - coding.setCode(resultCode); - if (StringUtils.isNotBlank(resultDisplay)) { - coding.setDisplay(resultDisplay); - } - return concept; - } - - private void addSNOMEDValue(String resultCode, Observation observation, String resultDisplay) { - var valueCodeableConcept = createSNOMEDConcept(resultCode, resultDisplay); - observation.setValue(valueCodeableConcept); - } - - private static int getTestDuration(TestEvent testEvent) { - return Optional.ofNullable(testEvent.getDeviceType()) - .map(DeviceType::getTestLength) - .orElse(FALLBACK_DEFAULT_TEST_MINUTES); - } - - public ServiceRequest convertToServiceRequest( - @NotNull TestOrder order, ZonedDateTime orderTestDate) { - ServiceRequestStatus serviceRequestStatus = null; - switch (order.getOrderStatus()) { - case PENDING: - serviceRequestStatus = ServiceRequestStatus.ACTIVE; - break; - case COMPLETED: - serviceRequestStatus = ServiceRequestStatus.COMPLETED; - break; - case CANCELED: - serviceRequestStatus = ServiceRequestStatus.REVOKED; - break; - } - - String deviceLoincCode = null; - if (order.getDeviceType() != null - && !order.getDeviceType().getSupportedDiseaseTestPerformed().isEmpty()) { - deviceLoincCode = - MultiplexUtils.inferMultiplexTestOrderLoinc( - order.getDeviceType().getSupportedDiseaseTestPerformed()); - } - return convertToServiceRequest( - serviceRequestStatus, - deviceLoincCode, - Objects.toString(order.getInternalId(), ""), - orderTestDate, - order.getPatient().getNotes()); - } - - public ServiceRequest convertToServiceRequest( - ServiceRequestStatus status, - String requestedCode, - String id, - ZonedDateTime orderEffectiveDate, - String notes) { - var serviceRequest = new ServiceRequest(); - serviceRequest.setId(id); - serviceRequest.setIntent(ServiceRequestIntent.ORDER); - serviceRequest.setStatus(status); - - if (StringUtils.isNotBlank(requestedCode)) { - serviceRequest.getCode().addCoding().setSystem(LOINC_CODE_SYSTEM).setCode(requestedCode); - } - - serviceRequest - .addExtension() - .setUrl(ORDER_CONTROL_EXTENSION_URL) - .setValue( - new CodeableConcept() - .addCoding( + public ServiceRequest convertToServiceRequest( + @NotNull TestOrder order, ZonedDateTime orderTestDate) { + ServiceRequestStatus serviceRequestStatus = null; + switch (order.getOrderStatus()) { + case PENDING: + serviceRequestStatus = ServiceRequestStatus.ACTIVE; + break; + case COMPLETED: + serviceRequestStatus = ServiceRequestStatus.COMPLETED; + break; + case CANCELED: + serviceRequestStatus = ServiceRequestStatus.REVOKED; + break; + } + + String deviceLoincCode = null; + if (order.getDeviceType() != null + && !order.getDeviceType().getSupportedDiseaseTestPerformed().isEmpty()) { + deviceLoincCode = + MultiplexUtils.inferMultiplexTestOrderLoinc( + order.getDeviceType().getSupportedDiseaseTestPerformed()); + } + return convertToServiceRequest( + serviceRequestStatus, + deviceLoincCode, + Objects.toString(order.getInternalId(), ""), + orderTestDate, + order.getPatient().getNotes()); + } + + public ServiceRequest convertToServiceRequest( + ServiceRequestStatus status, + String requestedCode, + String id, + ZonedDateTime orderEffectiveDate, + String notes) { + var serviceRequest = new ServiceRequest(); + serviceRequest.setId(id); + serviceRequest.setIntent(ServiceRequestIntent.ORDER); + serviceRequest.setStatus(status); + + if (StringUtils.isNotBlank(requestedCode)) { + serviceRequest.getCode().addCoding().setSystem(LOINC_CODE_SYSTEM).setCode(requestedCode); + } + + serviceRequest + .addExtension() + .setUrl(ORDER_CONTROL_EXTENSION_URL) + .setValue( + new CodeableConcept() + .addCoding( + new Coding() + .setSystem(ORDER_CONTROL_CODE_SYSTEM) + .setCode(ORDER_CONTROL_CODE_OBSERVATIONS))); + + serviceRequest + .addExtension() + .setUrl(ORDER_EFFECTIVE_DATE_EXTENSION_URL) + .setValue(convertToDateTimeType(orderEffectiveDate, TemporalPrecisionEnum.SECOND)); + + if (StringUtils.isNotEmpty(notes)) { + Coding noteTypeCoding = new Coding() - .setSystem(ORDER_CONTROL_CODE_SYSTEM) - .setCode(ORDER_CONTROL_CODE_OBSERVATIONS))); - - serviceRequest - .addExtension() - .setUrl(ORDER_EFFECTIVE_DATE_EXTENSION_URL) - .setValue(convertToDateTimeType(orderEffectiveDate, TemporalPrecisionEnum.SECOND)); - - if (StringUtils.isNotEmpty(notes)) { - Coding noteTypeCoding = - new Coding() - .setSystem(NOTE_TYPE_CODING_SYSTEM) - .setVersion(NOTE_TYPE_CODING_SYSTEM_VERSION) - .setCode(NOTE_TYPE_CODING_SYSTEM_CODE) - .setDisplay(NOTE_TYPE_CODING_SYSTEM_DISPLAY); - - noteTypeCoding - .addExtension() - .setUrl(NOTE_TYPE_CODING_SYSTEM_CODE_INDEX_EXTENSION_URL) - .setValue(new StringType(NOTE_TYPE_CODING_SYSTEM_CODE_INDEX_VALUE)); - - serviceRequest - .addNote() - .setText(notes) - .addExtension() - .setUrl(NOTE_TYPE_EXTENSION_URL) - .setValue(new CodeableConcept().addCoding(noteTypeCoding)); - } - - return serviceRequest; - } - - /** - * Used during single entry FHIR conversion - * - * @param testEvent Single entry test event. - * @param currentDate Used to set {@code DiagnosticReport.issued}, the instant this version was * - * made. - * @return DiagnosticReport - */ - public DiagnosticReport convertToDiagnosticReport(TestEvent testEvent, Date currentDate) { - DiagnosticReportStatus status = null; - switch (testEvent.getCorrectionStatus()) { - case ORIGINAL: - status = (DiagnosticReportStatus.FINAL); - break; - case CORRECTED: - status = (DiagnosticReportStatus.CORRECTED); - break; - case REMOVED: - status = (DiagnosticReportStatus.ENTEREDINERROR); - break; - } - - String code = null; - if (testEvent.getDeviceType() != null) { - code = - MultiplexUtils.inferMultiplexTestOrderLoinc( - testEvent.getDeviceType().getSupportedDiseaseTestPerformed()); - } - - ZonedDateTime dateTested = null; - if (testEvent.getDateTested() != null) { - int testDuration = getTestDuration(testEvent); - // getDateTested returns a Date representing an exact moment of time so - // finding a specific timezone for the TestEvent is not required to ensure it is accurate - dateTested = - ZonedDateTime.ofInstant( - testEvent.getDateTested().toInstant().minus(Duration.ofMinutes(testDuration)), - ZoneOffset.UTC); - } - ZonedDateTime dateIssued = null; - if (currentDate != null) - dateIssued = ZonedDateTime.ofInstant(currentDate.toInstant(), ZoneOffset.UTC); - - return convertToDiagnosticReport( - status, code, Objects.toString(testEvent.getInternalId(), ""), dateTested, dateIssued); - } - - /** - * @param status Diagnostic report status - * @param code LOINC code - * @param id Diagnostic report id - * @param dateTested Used to set {@code DiagnosticReport.effective}, the clinically relevant - * time/time-period for report. - * @param dateIssued Used to set {@code DiagnosticReport.issued}, the date and time that this - * version of the report was made available to providers, typically after the report was - * reviewed and verified. - * @return DiagnosticReport - */ - public DiagnosticReport convertToDiagnosticReport( - DiagnosticReportStatus status, - String code, - String id, - ZonedDateTime dateTested, - ZonedDateTime dateIssued) { - var diagnosticReport = - new DiagnosticReport() - .setStatus(status) - .setEffective(convertToDateTimeType(dateTested)) - .setIssuedElement(convertToInstantType(dateIssued, TemporalPrecisionEnum.SECOND)); - - diagnosticReport.setId(id); - if (StringUtils.isNotBlank(code)) { - diagnosticReport.getCode().addCoding().setSystem(LOINC_CODE_SYSTEM).setCode(code); - } - diagnosticReport.addIdentifier().setValue(id); - return diagnosticReport; - } - - /** - * @param testEvent The single entry test event created in {@code TestOrderService} - * @param gitProperties Git properties - * @param processingId Processing id - * @return FHIR bundle - * @see TestOrderService - */ - public Bundle createFhirBundle( - @NotNull TestEvent testEvent, GitProperties gitProperties, String processingId) { - - Date currentDate = dateGenerator.newDate(); - - ZonedDateTime dateTested = - testEvent.getDateTested() != null - ? ZonedDateTime.ofInstant(testEvent.getDateTested().toInstant(), ZoneOffset.UTC) - : null; - - int testDuration = getTestDuration(testEvent); - ZonedDateTime specimenCollectionDate = - dateTested != null ? dateTested.minus(Duration.ofMinutes(testDuration)) : null; - - List resultDiseases = - testEvent.getResults().stream().map(Result::getDisease).toList(); - List deviceTypeDiseaseEntries = - testEvent.getDeviceType().getSupportedDiseaseTestPerformed().stream() - .filter(code -> resultDiseases.contains(code.getSupportedDisease())) - .toList(); - String equipmentUid = - getCommonDiseaseValue(deviceTypeDiseaseEntries, DeviceTypeDisease::getEquipmentUid); - String equipmentUidType = - getCommonDiseaseValue(deviceTypeDiseaseEntries, DeviceTypeDisease::getEquipmentUidType); - return createFhirBundle( - CreateFhirBundleProps.builder() - .patient(convertToPatient(testEvent.getPatient(), testEvent.getFacility())) - .testingLab(convertToOrganization(testEvent.getFacility())) - .orderingFacility(null) - .practitioner(convertToPractitioner(testEvent.getProviderData())) - .device(convertToDevice(testEvent.getDeviceType(), equipmentUid, equipmentUidType)) - .specimen( - convertToSpecimen( - testEvent.getSpecimenType(), - uuidGenerator.randomUUID(), - specimenCollectionDate, - specimenCollectionDate)) - .resultObservations( - convertToObservation( - testEvent.getResults(), - testEvent.getDeviceType(), - testEvent.getCorrectionStatus(), - testEvent.getReasonForCorrection(), - testEvent.getDateTested())) - .aoeObservations( - convertToAOEObservations( - testEvent.getInternalId().toString(), - testEvent.getSurveyData(), - testEvent.getPatientData().getEmployedInHealthcare(), - testEvent.getPatientData().getResidentCongregateSetting())) - .serviceRequest(convertToServiceRequest(testEvent.getOrder(), dateTested)) - .diagnosticReport(convertToDiagnosticReport(testEvent, currentDate)) - .currentDate(currentDate) - .gitProperties(gitProperties) - .processingId(processingId) - .build()); - } - - public Bundle createFhirBundle(CreateFhirBundleProps props) { - var patientFullUrl = ResourceType.Patient + "/" + props.getPatient().getId(); - var orderingFacilityFullUrl = - props.getOrderingFacility() == null - ? null - : ResourceType.Organization + "/" + props.getOrderingFacility().getId(); - var testingLabOrganizationFullUrl = - ResourceType.Organization + "/" + props.getTestingLab().getId(); - var practitionerFullUrl = ResourceType.Practitioner + "/" + props.getPractitioner().getId(); - var specimenFullUrl = ResourceType.Specimen + "/" + props.getSpecimen().getId(); - var serviceRequestFullUrl = - ResourceType.ServiceRequest + "/" + props.getServiceRequest().getId(); - var diagnosticReportFullUrl = - ResourceType.DiagnosticReport + "/" + props.getDiagnosticReport().getId(); - var deviceFullUrl = ResourceType.Device + "/" + props.getDevice().getId(); - - var practitionerRole = - createPractitionerRole( - orderingFacilityFullUrl == null - ? testingLabOrganizationFullUrl - : orderingFacilityFullUrl, - practitionerFullUrl, - uuidGenerator.randomUUID()); - var provenance = - createProvenance( - testingLabOrganizationFullUrl, props.getCurrentDate(), uuidGenerator.randomUUID()); - var provenanceFullUrl = ResourceType.Provenance + "/" + provenance.getId(); - var messageHeader = - createMessageHeader( - testingLabOrganizationFullUrl, - diagnosticReportFullUrl, - provenanceFullUrl, - props.getGitProperties(), - props.getProcessingId(), - uuidGenerator.randomUUID()); - var practitionerRoleFullUrl = ResourceType.PractitionerRole + "/" + practitionerRole.getId(); - var messageHeaderFullUrl = ResourceType.MessageHeader + "/" + messageHeader.getId(); - - props.getPatient().setManagingOrganization(new Reference(testingLabOrganizationFullUrl)); - props.getSpecimen().setSubject(new Reference(patientFullUrl)); - - props.getServiceRequest().setSubject(new Reference(patientFullUrl)); - props.getServiceRequest().addPerformer(new Reference(testingLabOrganizationFullUrl)); - props.getServiceRequest().setRequester(new Reference(practitionerRoleFullUrl)); - props.getDiagnosticReport().addBasedOn(new Reference(serviceRequestFullUrl)); - props.getDiagnosticReport().setSubject(new Reference(patientFullUrl)); - props.getDiagnosticReport().addSpecimen(new Reference(specimenFullUrl)); - - var entryList = new ArrayList>(); - entryList.add(Pair.of(messageHeaderFullUrl, messageHeader)); - entryList.add(Pair.of(provenanceFullUrl, provenance)); - entryList.add(Pair.of(diagnosticReportFullUrl, props.getDiagnosticReport())); - entryList.add(Pair.of(patientFullUrl, props.getPatient())); - entryList.add(Pair.of(testingLabOrganizationFullUrl, props.getTestingLab())); - if (orderingFacilityFullUrl != null) { - entryList.add(Pair.of(orderingFacilityFullUrl, props.getOrderingFacility())); - } - entryList.add(Pair.of(practitionerFullUrl, props.getPractitioner())); - entryList.add(Pair.of(specimenFullUrl, props.getSpecimen())); - entryList.add(Pair.of(serviceRequestFullUrl, props.getServiceRequest())); - entryList.add(Pair.of(deviceFullUrl, props.getDevice())); - entryList.add(Pair.of(practitionerRoleFullUrl, practitionerRole)); - entryList.add( - Pair.of( - ResourceType.Organization + "/" + SIMPLE_REPORT_ORG_ID, - new Organization().setName("SimpleReport").setId(SIMPLE_REPORT_ORG_ID))); - - props - .getResultObservations() - .forEach( - observation -> { - var observationFullUrl = ResourceType.Observation + "/" + observation.getId(); - - observation.setSubject(new Reference(patientFullUrl)); - observation.addPerformer(new Reference(testingLabOrganizationFullUrl)); - observation.setSpecimen(new Reference(specimenFullUrl)); - observation.setDevice(new Reference(deviceFullUrl)); - - props.getDiagnosticReport().addResult(new Reference(observationFullUrl)); - entryList.add(Pair.of(observationFullUrl, observation)); - }); - - if (props.getAoeObservations() != null) { - props - .getAoeObservations() - .forEach( - observation -> { - var observationFullUrl = ResourceType.Observation + "/" + observation.getId(); - - observation.setSubject(new Reference(patientFullUrl)); - - props.getServiceRequest().addSupportingInfo(new Reference(observationFullUrl)); - entryList.add(Pair.of(observationFullUrl, observation)); - }); - } - - var bundle = - new Bundle() - .setType(BundleType.MESSAGE) - .setTimestamp(props.getCurrentDate()) - .setIdentifier(new Identifier().setValue(props.getDiagnosticReport().getId())); - - bundle.getTimestampElement().setTimeZoneZulu(true); - - entryList.forEach( - pair -> - bundle.addEntry( - new BundleEntryComponent() - .setFullUrl(pair.getFirst()) - .setResource(pair.getSecond()))); - - return bundle; - } - - public Provenance createProvenance( - String organizationFullUrl, Date dateTested, UUID provenanceId) { - var provenance = new Provenance(); - - provenance.setId(provenanceId.toString()); - provenance - .getActivity() - .addCoding() - .setSystem(EVENT_TYPE_CODE_SYSTEM) - .setCode(EVENT_TYPE_CODE) - .setDisplay(EVENT_TYPE_DISPLAY); - provenance.addAgent().setWho(new Reference().setReference(organizationFullUrl)); - provenance.setRecorded(dateTested); - provenance.getRecordedElement().setTimeZoneZulu(true); - return provenance; - } - - public PractitionerRole createPractitionerRole( - String organizationUrl, String practitionerUrl, UUID practitionerRoleId) { - var practitionerRole = new PractitionerRole(); - practitionerRole.setId(practitionerRoleId.toString()); - practitionerRole - .setPractitioner(new Reference().setReference(practitionerUrl)) - .setOrganization(new Reference().setReference(organizationUrl)); - return practitionerRole; - } - - public MessageHeader createMessageHeader( - String organizationUrl, - String mainResourceUrl, - String provenanceFullUrl, - GitProperties gitProperties, - String processingId, - UUID messageHeaderId) { - var messageHeader = new MessageHeader(); - messageHeader.setId(messageHeaderId.toString()); - messageHeader - .getEventCoding() - .setSystem(EVENT_TYPE_CODE_SYSTEM) - .setCode(EVENT_TYPE_CODE) - .setDisplay(EVENT_TYPE_DISPLAY); - messageHeader - .getSource() - .setSoftware("PRIME SimpleReport") - .setEndpoint("https://simplereport.gov") - .setVersion(gitProperties.getShortCommitId()); - messageHeader - .addDestination() - .setName("PRIME ReportStream") - .setEndpoint("https://prime.cdc.gov/api/reports?option=SkipInvalidItems"); - if (!StringUtils.isBlank(organizationUrl)) { - messageHeader.getSender().setReferenceElement(new StringType(organizationUrl)); - } - if (!StringUtils.isBlank(provenanceFullUrl)) { - messageHeader.addFocus(new Reference(provenanceFullUrl)); - } - messageHeader - .getSource() - .addExtension() - .setUrl("https://reportstream.cdc.gov/fhir/StructureDefinition/software-binary-id") - .setValue(new StringType(gitProperties.getShortCommitId())); - messageHeader - .getSource() - .addExtension() - .setUrl("https://reportstream.cdc.gov/fhir/StructureDefinition/software-install-date") - .setValue(new InstantType(gitProperties.getCommitTime().toString())); - messageHeader - .getSource() - .addExtension() - .setUrl("https://reportstream.cdc.gov/fhir/StructureDefinition/software-vendor-org") - .setValue(new Reference(ResourceType.Organization + "/" + SIMPLE_REPORT_ORG_ID)); - messageHeader - .getMeta() - .addTag(PROCESSING_ID_SYSTEM, processingId, PROCESSING_ID_DISPLAY.get(processingId)); - messageHeader.addFocus(new Reference(mainResourceUrl)); - - return messageHeader; - } - - public DiagnosticReport convertToDiagnosticReport( - ConditionAgnosticConvertToDiagnosticReportProps props) { - DiagnosticReport diagnosticReport = new DiagnosticReport(); - var categoryCodeableConcept = new CodeableConcept(); - var categoryCoding = categoryCodeableConcept.addCoding(); - categoryCoding.setSystem(DIAGNOSTIC_CODE_SYSTEM); - categoryCoding.setCode(LAB_STRING_LITERAL); - diagnosticReport.setCategory(List.of(categoryCodeableConcept)); - - var diagnosticCodeableConcept = new CodeableConcept(); - var diagnosticCoding = diagnosticCodeableConcept.addCoding(); - - diagnosticCoding.setSystem(LOINC_CODE_SYSTEM).setCode(props.getTestPerformedCode()); - diagnosticReport.setCode(diagnosticCodeableConcept); - - var effectiveDateTime = DateTimeUtils.convertToZonedDateTime(props.getTestEffectiveDate()); - diagnosticReport.setEffective(convertToDateTimeType(effectiveDateTime)); - - String diagnosticReportId = uuidGenerator.randomUUID().toString(); - diagnosticReport.setId(diagnosticReportId); - - return diagnosticReport; - } - - public Observation convertToObservation(ConditionAgnosticConvertToObservationProps props) { - Observation observation = new Observation(); - setStatus(observation, props.getCorrectionStatus()); - - var labCodeableConcept = new CodeableConcept(); - var labCodeableCoding = labCodeableConcept.addCoding(); - labCodeableCoding.setSystem(OBSERVATION_CATEGORY_CODE_SYSTEM); - labCodeableCoding.setCode(LABORATORY_STRING_LITERAL); - observation.setCategory(List.of(labCodeableConcept)); - - var observationCodeableConcept = new CodeableConcept(); - var observationCoding = observationCodeableConcept.addCoding(); - observationCoding.setSystem(LOINC_CODE_SYSTEM).setCode(props.getTestPerformedCode()); - observation.setCode(observationCodeableConcept); - - addSNOMEDValue(props.getResultValue(), observation, null); - - String observationId = uuidGenerator.randomUUID().toString(); - observation.setId(observationId); - - return observation; - } - - public Patient convertToPatient(ConditionAgnosticConvertToPatientProps props) { - var patient = new Patient(); - patient.setId(props.getId()); - assignPotentiallyAbsentName( - props.getFirstName(), props.getLastName(), props.getNameAbsentReason(), patient); - patient.setGender(convertToAdministrativeGender(props.getGender())); - return patient; - } - - private Patient assignPotentiallyAbsentName( - String first, String last, String absentReason, Patient patient) { - if (StringUtils.isNotBlank(first) || StringUtils.isNotBlank(last)) { - var humanName = convertToHumanName(first, null, last, null); - patient.addName(humanName); - - } else { - patient - .addName() - .addExtension( - new Extension() - .setUrl(DATA_ABSENT_REASON_EXTENSION_URL) - .setValue(new CodeableConcept().addCoding().setCode(absentReason))); - } - return patient; - } - - public Bundle createFhirBundle(ConditionAgnosticCreateFhirBundleProps props) { - - var patientFullUrl = ResourceType.Patient + "/" + props.getPatient().getId(); - props.getDiagnosticReport().setSubject(new Reference(patientFullUrl)); - - var diagnosticReportFullUrl = - ResourceType.DiagnosticReport + "/" + props.getDiagnosticReport().getId(); - - UUID messageHeaderId = uuidGenerator.randomUUID(); - var messageHeader = - createMessageHeader( - null, - diagnosticReportFullUrl, - null, - props.getGitProperties(), - props.getProcessingId(), - messageHeaderId); - var messageHeaderFullUrl = ResourceType.MessageHeader + "/" + messageHeader.getId(); - - var entryList = new ArrayList>(); - entryList.add(Pair.of(messageHeaderFullUrl, messageHeader)); - entryList.add(Pair.of(patientFullUrl, props.getPatient())); - entryList.add( - Pair.of( - ResourceType.Organization + "/" + SIMPLE_REPORT_ORG_ID, - new Organization().setName("SimpleReport").setId(SIMPLE_REPORT_ORG_ID))); - - props - .getResultObservations() - .forEach( - observation -> { - var observationFullUrl = ResourceType.Observation + "/" + observation.getId(); - observation.setSubject(new Reference(patientFullUrl)); - entryList.add(Pair.of(observationFullUrl, observation)); - Reference observationReference = new Reference(observationFullUrl); - props.getDiagnosticReport().addResult(observationReference); - }); - - entryList.add(Pair.of(diagnosticReportFullUrl, props.getDiagnosticReport())); - Date currentDate = dateGenerator.newDate(); - - var bundle = - new Bundle() - .setType(Bundle.BundleType.MESSAGE) - .setTimestamp(currentDate) - .setIdentifier(new Identifier().setValue(props.getDiagnosticReport().getId())); - - bundle.getTimestampElement().setTimeZoneZulu(true); - - entryList.forEach( - pair -> - bundle.addEntry( - new Bundle.BundleEntryComponent() - .setFullUrl(pair.getFirst()) - .setResource(pair.getSecond()))); - - return bundle; - } + .setSystem(NOTE_TYPE_CODING_SYSTEM) + .setVersion(NOTE_TYPE_CODING_SYSTEM_VERSION) + .setCode(NOTE_TYPE_CODING_SYSTEM_CODE) + .setDisplay(NOTE_TYPE_CODING_SYSTEM_DISPLAY); + + noteTypeCoding + .addExtension() + .setUrl(NOTE_TYPE_CODING_SYSTEM_CODE_INDEX_EXTENSION_URL) + .setValue(new StringType(NOTE_TYPE_CODING_SYSTEM_CODE_INDEX_VALUE)); + + serviceRequest + .addNote() + .setText(notes) + .addExtension() + .setUrl(NOTE_TYPE_EXTENSION_URL) + .setValue(new CodeableConcept().addCoding(noteTypeCoding)); + } + + return serviceRequest; + } + + /** + * Used during single entry FHIR conversion + * + * @param testEvent Single entry test event. + * @param currentDate Used to set {@code DiagnosticReport.issued}, the instant this version was * + * made. + * @return DiagnosticReport + */ + public DiagnosticReport convertToDiagnosticReport(TestEvent testEvent, Date currentDate) { + DiagnosticReportStatus status = null; + switch (testEvent.getCorrectionStatus()) { + case ORIGINAL: + status = (DiagnosticReportStatus.FINAL); + break; + case CORRECTED: + status = (DiagnosticReportStatus.CORRECTED); + break; + case REMOVED: + status = (DiagnosticReportStatus.ENTEREDINERROR); + break; + } + + String code = null; + if (testEvent.getDeviceType() != null) { + code = + MultiplexUtils.inferMultiplexTestOrderLoinc( + testEvent.getDeviceType().getSupportedDiseaseTestPerformed()); + } + + ZonedDateTime dateTested = null; + if (testEvent.getDateTested() != null) { + int testDuration = getTestDuration(testEvent); + // getDateTested returns a Date representing an exact moment of time so + // finding a specific timezone for the TestEvent is not required to ensure it is accurate + dateTested = + ZonedDateTime.ofInstant( + testEvent.getDateTested().toInstant().minus(Duration.ofMinutes(testDuration)), + ZoneOffset.UTC); + } + ZonedDateTime dateIssued = null; + if (currentDate != null) + dateIssued = ZonedDateTime.ofInstant(currentDate.toInstant(), ZoneOffset.UTC); + + return convertToDiagnosticReport( + status, code, Objects.toString(testEvent.getInternalId(), ""), dateTested, dateIssued); + } + + /** + * @param status Diagnostic report status + * @param code LOINC code + * @param id Diagnostic report id + * @param dateTested Used to set {@code DiagnosticReport.effective}, the clinically relevant + * time/time-period for report. + * @param dateIssued Used to set {@code DiagnosticReport.issued}, the date and time that this + * version of the report was made available to providers, typically after the report was + * reviewed and verified. + * @return DiagnosticReport + */ + public DiagnosticReport convertToDiagnosticReport( + DiagnosticReportStatus status, + String code, + String id, + ZonedDateTime dateTested, + ZonedDateTime dateIssued) { + var diagnosticReport = + new DiagnosticReport() + .setStatus(status) + .setEffective(convertToDateTimeType(dateTested)) + .setIssuedElement(convertToInstantType(dateIssued, TemporalPrecisionEnum.SECOND)); + + diagnosticReport.setId(id); + if (StringUtils.isNotBlank(code)) { + diagnosticReport.getCode().addCoding().setSystem(LOINC_CODE_SYSTEM).setCode(code); + } + diagnosticReport.addIdentifier().setValue(id); + return diagnosticReport; + } + + /** + * @param testEvent The single entry test event created in {@code TestOrderService} + * @param gitProperties Git properties + * @param processingId Processing id + * @return FHIR bundle + * @see TestOrderService + */ + public Bundle createFhirBundle( + @NotNull TestEvent testEvent, GitProperties gitProperties, String processingId) { + + Date currentDate = dateGenerator.newDate(); + + ZonedDateTime dateTested = + testEvent.getDateTested() != null + ? ZonedDateTime.ofInstant(testEvent.getDateTested().toInstant(), ZoneOffset.UTC) + : null; + + int testDuration = getTestDuration(testEvent); + ZonedDateTime specimenCollectionDate = + dateTested != null ? dateTested.minus(Duration.ofMinutes(testDuration)) : null; + + List resultDiseases = + testEvent.getResults().stream().map(Result::getDisease).toList(); + List deviceTypeDiseaseEntries = + testEvent.getDeviceType().getSupportedDiseaseTestPerformed().stream() + .filter(code -> resultDiseases.contains(code.getSupportedDisease())) + .toList(); + String equipmentUid = + getCommonDiseaseValue(deviceTypeDiseaseEntries, DeviceTypeDisease::getEquipmentUid); + String equipmentUidType = + getCommonDiseaseValue(deviceTypeDiseaseEntries, DeviceTypeDisease::getEquipmentUidType); + return createFhirBundle( + CreateFhirBundleProps.builder() + .patient(convertToPatient(testEvent.getPatient(), testEvent.getFacility())) + .testingLab(convertToOrganization(testEvent.getFacility())) + .orderingFacility(null) + .practitioner(convertToPractitioner(testEvent.getProviderData())) + .device(convertToDevice(testEvent.getDeviceType(), equipmentUid, equipmentUidType)) + .specimen( + convertToSpecimen( + testEvent.getSpecimenType(), + uuidGenerator.randomUUID(), + specimenCollectionDate, + specimenCollectionDate)) + .resultObservations( + convertToObservation( + testEvent.getResults(), + testEvent.getDeviceType(), + testEvent.getCorrectionStatus(), + testEvent.getReasonForCorrection(), + testEvent.getDateTested())) + .aoeObservations( + convertToAOEObservations( + testEvent.getInternalId().toString(), + testEvent.getSurveyData(), + testEvent.getPatientData().getEmployedInHealthcare(), + testEvent.getPatientData().getResidentCongregateSetting())) + .serviceRequest(convertToServiceRequest(testEvent.getOrder(), dateTested)) + .diagnosticReport(convertToDiagnosticReport(testEvent, currentDate)) + .currentDate(currentDate) + .gitProperties(gitProperties) + .processingId(processingId) + .build()); + } + + public Bundle createFhirBundle(CreateFhirBundleProps props) { + var patientFullUrl = ResourceType.Patient + "/" + props.getPatient().getId(); + var orderingFacilityFullUrl = + props.getOrderingFacility() == null + ? null + : ResourceType.Organization + "/" + props.getOrderingFacility().getId(); + var testingLabOrganizationFullUrl = + ResourceType.Organization + "/" + props.getTestingLab().getId(); + var practitionerFullUrl = ResourceType.Practitioner + "/" + props.getPractitioner().getId(); + var specimenFullUrl = ResourceType.Specimen + "/" + props.getSpecimen().getId(); + var serviceRequestFullUrl = + ResourceType.ServiceRequest + "/" + props.getServiceRequest().getId(); + var diagnosticReportFullUrl = + ResourceType.DiagnosticReport + "/" + props.getDiagnosticReport().getId(); + var deviceFullUrl = ResourceType.Device + "/" + props.getDevice().getId(); + + var practitionerRole = + createPractitionerRole( + orderingFacilityFullUrl == null + ? testingLabOrganizationFullUrl + : orderingFacilityFullUrl, + practitionerFullUrl, + uuidGenerator.randomUUID()); + var provenance = + createProvenance( + testingLabOrganizationFullUrl, props.getCurrentDate(), uuidGenerator.randomUUID()); + var provenanceFullUrl = ResourceType.Provenance + "/" + provenance.getId(); + var messageHeader = + createMessageHeader( + testingLabOrganizationFullUrl, + diagnosticReportFullUrl, + provenanceFullUrl, + props.getGitProperties(), + props.getProcessingId(), + uuidGenerator.randomUUID()); + var practitionerRoleFullUrl = ResourceType.PractitionerRole + "/" + practitionerRole.getId(); + var messageHeaderFullUrl = ResourceType.MessageHeader + "/" + messageHeader.getId(); + + props.getPatient().setManagingOrganization(new Reference(testingLabOrganizationFullUrl)); + props.getSpecimen().setSubject(new Reference(patientFullUrl)); + + props.getServiceRequest().setSubject(new Reference(patientFullUrl)); + props.getServiceRequest().addPerformer(new Reference(testingLabOrganizationFullUrl)); + props.getServiceRequest().setRequester(new Reference(practitionerRoleFullUrl)); + props.getDiagnosticReport().addBasedOn(new Reference(serviceRequestFullUrl)); + props.getDiagnosticReport().setSubject(new Reference(patientFullUrl)); + props.getDiagnosticReport().addSpecimen(new Reference(specimenFullUrl)); + + var entryList = new ArrayList>(); + entryList.add(Pair.of(messageHeaderFullUrl, messageHeader)); + entryList.add(Pair.of(provenanceFullUrl, provenance)); + entryList.add(Pair.of(diagnosticReportFullUrl, props.getDiagnosticReport())); + entryList.add(Pair.of(patientFullUrl, props.getPatient())); + entryList.add(Pair.of(testingLabOrganizationFullUrl, props.getTestingLab())); + if (orderingFacilityFullUrl != null) { + entryList.add(Pair.of(orderingFacilityFullUrl, props.getOrderingFacility())); + } + entryList.add(Pair.of(practitionerFullUrl, props.getPractitioner())); + entryList.add(Pair.of(specimenFullUrl, props.getSpecimen())); + entryList.add(Pair.of(serviceRequestFullUrl, props.getServiceRequest())); + entryList.add(Pair.of(deviceFullUrl, props.getDevice())); + entryList.add(Pair.of(practitionerRoleFullUrl, practitionerRole)); + entryList.add( + Pair.of( + ResourceType.Organization + "/" + SIMPLE_REPORT_ORG_ID, + new Organization().setName("SimpleReport").setId(SIMPLE_REPORT_ORG_ID))); + + props + .getResultObservations() + .forEach( + observation -> { + var observationFullUrl = ResourceType.Observation + "/" + observation.getId(); + + observation.setSubject(new Reference(patientFullUrl)); + observation.addPerformer(new Reference(testingLabOrganizationFullUrl)); + observation.setSpecimen(new Reference(specimenFullUrl)); + observation.setDevice(new Reference(deviceFullUrl)); + + props.getDiagnosticReport().addResult(new Reference(observationFullUrl)); + entryList.add(Pair.of(observationFullUrl, observation)); + }); + + if (props.getAoeObservations() != null) { + props + .getAoeObservations() + .forEach( + observation -> { + var observationFullUrl = ResourceType.Observation + "/" + observation.getId(); + + observation.setSubject(new Reference(patientFullUrl)); + + props.getServiceRequest().addSupportingInfo(new Reference(observationFullUrl)); + entryList.add(Pair.of(observationFullUrl, observation)); + }); + } + + var bundle = + new Bundle() + .setType(BundleType.MESSAGE) + .setTimestamp(props.getCurrentDate()) + .setIdentifier(new Identifier().setValue(props.getDiagnosticReport().getId())); + + bundle.getTimestampElement().setTimeZoneZulu(true); + + entryList.forEach( + pair -> + bundle.addEntry( + new BundleEntryComponent() + .setFullUrl(pair.getFirst()) + .setResource(pair.getSecond()))); + + return bundle; + } + + public Provenance createProvenance( + String organizationFullUrl, Date dateTested, UUID provenanceId) { + var provenance = new Provenance(); + + provenance.setId(provenanceId.toString()); + provenance + .getActivity() + .addCoding() + .setSystem(EVENT_TYPE_CODE_SYSTEM) + .setCode(EVENT_TYPE_CODE) + .setDisplay(EVENT_TYPE_DISPLAY); + provenance.addAgent().setWho(new Reference().setReference(organizationFullUrl)); + provenance.setRecorded(dateTested); + provenance.getRecordedElement().setTimeZoneZulu(true); + return provenance; + } + + public PractitionerRole createPractitionerRole( + String organizationUrl, String practitionerUrl, UUID practitionerRoleId) { + var practitionerRole = new PractitionerRole(); + practitionerRole.setId(practitionerRoleId.toString()); + practitionerRole + .setPractitioner(new Reference().setReference(practitionerUrl)) + .setOrganization(new Reference().setReference(organizationUrl)); + return practitionerRole; + } + + public MessageHeader createMessageHeader( + String organizationUrl, + String mainResourceUrl, + String provenanceFullUrl, + GitProperties gitProperties, + String processingId, + UUID messageHeaderId) { + var messageHeader = new MessageHeader(); + messageHeader.setId(messageHeaderId.toString()); + messageHeader + .getEventCoding() + .setSystem(EVENT_TYPE_CODE_SYSTEM) + .setCode(EVENT_TYPE_CODE) + .setDisplay(EVENT_TYPE_DISPLAY); + messageHeader + .getSource() + .setSoftware("PRIME SimpleReport") + .setEndpoint("https://simplereport.gov") + .setVersion(gitProperties.getShortCommitId()); + messageHeader + .addDestination() + .setName("PRIME ReportStream") + .setEndpoint("https://prime.cdc.gov/api/reports?option=SkipInvalidItems"); + if (!StringUtils.isBlank(organizationUrl)) { + messageHeader.getSender().setReferenceElement(new StringType(organizationUrl)); + } + if (!StringUtils.isBlank(provenanceFullUrl)) { + messageHeader.addFocus(new Reference(provenanceFullUrl)); + } + messageHeader + .getSource() + .addExtension() + .setUrl("https://reportstream.cdc.gov/fhir/StructureDefinition/software-binary-id") + .setValue(new StringType(gitProperties.getShortCommitId())); + messageHeader + .getSource() + .addExtension() + .setUrl("https://reportstream.cdc.gov/fhir/StructureDefinition/software-install-date") + .setValue(new InstantType(gitProperties.getCommitTime().toString())); + messageHeader + .getSource() + .addExtension() + .setUrl("https://reportstream.cdc.gov/fhir/StructureDefinition/software-vendor-org") + .setValue(new Reference(ResourceType.Organization + "/" + SIMPLE_REPORT_ORG_ID)); + messageHeader + .getMeta() + .addTag(PROCESSING_ID_SYSTEM, processingId, PROCESSING_ID_DISPLAY.get(processingId)); + messageHeader.addFocus(new Reference(mainResourceUrl)); + + return messageHeader; + } + + public DiagnosticReport convertToDiagnosticReport( + ConditionAgnosticConvertToDiagnosticReportProps props) { + DiagnosticReport diagnosticReport = new DiagnosticReport(); + var categoryCodeableConcept = new CodeableConcept(); + var categoryCoding = categoryCodeableConcept.addCoding(); + categoryCoding.setSystem(DIAGNOSTIC_CODE_SYSTEM); + categoryCoding.setCode(LAB_STRING_LITERAL); + diagnosticReport.setCategory(List.of(categoryCodeableConcept)); + + var diagnosticCodeableConcept = new CodeableConcept(); + var diagnosticCoding = diagnosticCodeableConcept.addCoding(); + + diagnosticCoding.setSystem(LOINC_CODE_SYSTEM).setCode(props.getTestPerformedCode()); + diagnosticReport.setCode(diagnosticCodeableConcept); + + var effectiveDateTime = DateTimeUtils.convertToZonedDateTime(props.getTestEffectiveDate()); + diagnosticReport.setEffective(convertToDateTimeType(effectiveDateTime)); + + String diagnosticReportId = uuidGenerator.randomUUID().toString(); + diagnosticReport.setId(diagnosticReportId); + + return diagnosticReport; + } + + public Observation convertToObservation(ConditionAgnosticConvertToObservationProps props) { + Observation observation = new Observation(); + setStatus(observation, props.getCorrectionStatus()); + + var labCodeableConcept = new CodeableConcept(); + var labCodeableCoding = labCodeableConcept.addCoding(); + labCodeableCoding.setSystem(OBSERVATION_CATEGORY_CODE_SYSTEM); + labCodeableCoding.setCode(LABORATORY_STRING_LITERAL); + observation.setCategory(List.of(labCodeableConcept)); + + var observationCodeableConcept = new CodeableConcept(); + var observationCoding = observationCodeableConcept.addCoding(); + observationCoding.setSystem(LOINC_CODE_SYSTEM).setCode(props.getTestPerformedCode()); + observation.setCode(observationCodeableConcept); + + addSNOMEDValue(props.getResultValue(), observation, null); + + String observationId = uuidGenerator.randomUUID().toString(); + observation.setId(observationId); + + return observation; + } + + public Patient convertToPatient(ConditionAgnosticConvertToPatientProps props) { + var patient = new Patient(); + patient.setId(props.getId()); + assignPotentiallyAbsentName( + props.getFirstName(), props.getLastName(), props.getNameAbsentReason(), patient); + patient.setGender(convertToAdministrativeGender(props.getGender())); + return patient; + } + + private Patient assignPotentiallyAbsentName( + String first, String last, String absentReason, Patient patient) { + if (StringUtils.isNotBlank(first) || StringUtils.isNotBlank(last)) { + var humanName = convertToHumanName(first, null, last, null); + patient.addName(humanName); + + } else { + patient + .addName() + .addExtension( + new Extension() + .setUrl(DATA_ABSENT_REASON_EXTENSION_URL) + .setValue(new CodeableConcept().addCoding().setCode(absentReason))); + } + return patient; + } + + public Bundle createFhirBundle(ConditionAgnosticCreateFhirBundleProps props) { + + var patientFullUrl = ResourceType.Patient + "/" + props.getPatient().getId(); + props.getDiagnosticReport().setSubject(new Reference(patientFullUrl)); + + var diagnosticReportFullUrl = + ResourceType.DiagnosticReport + "/" + props.getDiagnosticReport().getId(); + + UUID messageHeaderId = uuidGenerator.randomUUID(); + var messageHeader = + createMessageHeader( + null, + diagnosticReportFullUrl, + null, + props.getGitProperties(), + props.getProcessingId(), + messageHeaderId); + var messageHeaderFullUrl = ResourceType.MessageHeader + "/" + messageHeader.getId(); + + var entryList = new ArrayList>(); + entryList.add(Pair.of(messageHeaderFullUrl, messageHeader)); + entryList.add(Pair.of(patientFullUrl, props.getPatient())); + entryList.add( + Pair.of( + ResourceType.Organization + "/" + SIMPLE_REPORT_ORG_ID, + new Organization().setName("SimpleReport").setId(SIMPLE_REPORT_ORG_ID))); + + props + .getResultObservations() + .forEach( + observation -> { + var observationFullUrl = ResourceType.Observation + "/" + observation.getId(); + observation.setSubject(new Reference(patientFullUrl)); + entryList.add(Pair.of(observationFullUrl, observation)); + Reference observationReference = new Reference(observationFullUrl); + props.getDiagnosticReport().addResult(observationReference); + }); + + entryList.add(Pair.of(diagnosticReportFullUrl, props.getDiagnosticReport())); + Date currentDate = dateGenerator.newDate(); + + var bundle = + new Bundle() + .setType(Bundle.BundleType.MESSAGE) + .setTimestamp(currentDate) + .setIdentifier(new Identifier().setValue(props.getDiagnosticReport().getId())); + + bundle.getTimestampElement().setTimeZoneZulu(true); + + entryList.forEach( + pair -> + bundle.addEntry( + new Bundle.BundleEntryComponent() + .setFullUrl(pair.getFirst()) + .setResource(pair.getSecond()))); + + return bundle; + } } diff --git a/backend/src/main/java/gov/cdc/usds/simplereport/api/model/TestEventExport.java b/backend/src/main/java/gov/cdc/usds/simplereport/api/model/TestEventExport.java index 58a12f4b5d9..14942a37530 100644 --- a/backend/src/main/java/gov/cdc/usds/simplereport/api/model/TestEventExport.java +++ b/backend/src/main/java/gov/cdc/usds/simplereport/api/model/TestEventExport.java @@ -75,10 +75,14 @@ public TestEventExport(TestEvent testEvent, String processingModeCode) { } private String genderUnknown = "U"; - private static final String DEFAULT_LOCATION_CODE = "53342003"; // http://snomed.info/id/53342003 + public static final String DEFAULT_LOCATION_CODE = "53342003"; // http://snomed.info/id/53342003 // "Internal nose structure" // values pulled from // https://github.com/CDCgov/prime-data-hub/blob/master/prime-router/metadata/valuesets/common.valuesets + + public static final String DEFAULT_LOCATION_NAME = + "Internal nose structure (body structure)"; // http://snomed.info/id/53342003 + private final Map genderMap = Map.of( "male", "M", diff --git a/backend/src/test/java/gov/cdc/usds/simplereport/api/converter/FhirConverterTest.java b/backend/src/test/java/gov/cdc/usds/simplereport/api/converter/FhirConverterTest.java index 80e5da324b8..ec43ac1a8ba 100644 --- a/backend/src/test/java/gov/cdc/usds/simplereport/api/converter/FhirConverterTest.java +++ b/backend/src/test/java/gov/cdc/usds/simplereport/api/converter/FhirConverterTest.java @@ -1,6 +1,8 @@ package gov.cdc.usds.simplereport.api.converter; import static gov.cdc.usds.simplereport.api.converter.FhirConstants.NOTE_TYPE_EXTENSION_URL; +import static gov.cdc.usds.simplereport.api.model.TestEventExport.DEFAULT_LOCATION_CODE; +import static gov.cdc.usds.simplereport.api.model.TestEventExport.DEFAULT_LOCATION_NAME; import static gov.cdc.usds.simplereport.api.model.TestEventExport.UNKNOWN_ADDRESS_INDICATOR; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.from; @@ -588,8 +590,8 @@ void convertToSpecimen_Strings_valid() { ConvertToSpecimenProps.builder() .specimenCode("258500001") .specimenName("Nasopharyngeal swab") - .collectionCode("53342003") - .collectionName("Internal nose structure (body structure)") + .collectionCode("53342003 but not the default one") + .collectionName("Internal nose structure (body structure) but not the default one") .id("id-123") .identifier("uuid-123") .collectionDate(collectionDate) @@ -607,9 +609,9 @@ void convertToSpecimen_Strings_valid() { assertThat(actual.getCollection().getBodySite().getCodingFirstRep().getSystem()) .isEqualTo(snomedCode); assertThat(actual.getCollection().getBodySite().getCodingFirstRep().getCode()) - .isEqualTo("53342003"); + .isEqualTo("53342003 but not the default one"); assertThat(actual.getCollection().getBodySite().getText()) - .isEqualTo("Internal nose structure (body structure)"); + .isEqualTo("Internal nose structure (body structure) but not the default one"); assertThat(((DateTimeType) actual.getCollection().getCollected()).getValue()) .isEqualTo("2023-06-22T16:38:00Z"); } @@ -621,8 +623,9 @@ void convertToSpecimen_Strings_null() { assertThat(actual.getId()).isNull(); assertThat(actual.getType().getText()).isNull(); assertThat(actual.getType().getCoding()).isEmpty(); - assertThat(actual.getCollection().getBodySite().getText()).isNull(); - assertThat(actual.getCollection().getBodySite().getCoding()).isEmpty(); + assertThat(actual.getCollection().getBodySite().getText()).isEqualTo(DEFAULT_LOCATION_NAME); + assertThat(actual.getCollection().getBodySite().getCodingFirstRep().getCode()) + .isEqualTo(DEFAULT_LOCATION_CODE); assertThat(actual.getCollection().getCollected()).isNull(); assertThat(actual.getReceivedTime()).isNull(); } @@ -668,7 +671,7 @@ void convertToSpecimen_SpecimenType_valid() { @Test void convertToSpecimen_SpecimenType_matchesJson() throws IOException { var internalId = "3c9c7370-e2e3-49ad-bb7a-f6005f41cf29"; - SpecimenType specimenType = new SpecimenType("nasal", "40001", "nose", "10101"); + SpecimenType specimenType = new SpecimenType("nasal", "40001"); ReflectionTestUtils.setField(specimenType, "internalId", UUID.fromString(internalId)); var actual = diff --git a/backend/src/test/resources/fhir/bundle.json b/backend/src/test/resources/fhir/bundle.json index f642f81c76a..c832a6c3476 100644 --- a/backend/src/test/resources/fhir/bundle.json +++ b/backend/src/test/resources/fhir/bundle.json @@ -321,6 +321,15 @@ }, "receivedTime": "2023-07-14T15:45:34+00:00", "collection": { + "bodySite": { + "coding": [ + { + "system": "http://snomed.info/sct", + "code": "53342003" + } + ], + "text": "Internal nose structure (body structure)" + }, "collectedDateTime": "2023-07-14T15:45:34+00:00" } } diff --git a/backend/src/test/resources/fhir/bundles-upload-integration-testing.ndjson b/backend/src/test/resources/fhir/bundles-upload-integration-testing.ndjson index 3b459700137..683cf5a1fcb 100644 --- a/backend/src/test/resources/fhir/bundles-upload-integration-testing.ndjson +++ b/backend/src/test/resources/fhir/bundles-upload-integration-testing.ndjson @@ -345,7 +345,16 @@ }, "receivedTime": "2023-07-10T08:51:00-04:00", "collection": { - "collectedDateTime": "2023-07-10T08:51:00-04:00" + "collectedDateTime": "2023-07-10T08:51:00-04:00", + "bodySite": { + "coding": [ + { + "system": "http://snomed.info/sct", + "code": "53342003" + } + ], + "text": "Internal nose structure (body structure)" + } } } }, @@ -1165,7 +1174,16 @@ }, "receivedTime": "2021-12-21T17:00:00-05:00", "collection": { - "collectedDateTime": "2021-12-21T17:00:00-05:00" + "collectedDateTime": "2021-12-21T17:00:00-05:00", + "bodySite": { + "coding": [ + { + "system": "http://snomed.info/sct", + "code": "53342003" + } + ], + "text": "Internal nose structure (body structure)" + } } } }, @@ -1712,7 +1730,16 @@ }, "receivedTime": "2021-12-21T15:00:00-05:00", "collection": { - "collectedDateTime": "2021-12-21T15:00:00-05:00" + "collectedDateTime": "2021-12-21T15:00:00-05:00", + "bodySite": { + "coding": [ + { + "system": "http://snomed.info/sct", + "code": "53342003" + } + ], + "text": "Internal nose structure (body structure)" + } } } }, @@ -2303,7 +2330,16 @@ }, "receivedTime": "2022-01-05T12:00:00-05:00", "collection": { - "collectedDateTime": "2022-01-05T12:00:00-05:00" + "collectedDateTime": "2022-01-05T12:00:00-05:00", + "bodySite": { + "coding": [ + { + "system": "http://snomed.info/sct", + "code": "53342003" + } + ], + "text": "Internal nose structure (body structure)" + } } } }, @@ -2850,7 +2886,16 @@ }, "receivedTime": "2022-01-05T12:00:00-05:00", "collection": { - "collectedDateTime": "2022-01-05T12:00:00-05:00" + "collectedDateTime": "2022-01-05T12:00:00-05:00", + "bodySite": { + "coding": [ + { + "system": "http://snomed.info/sct", + "code": "53342003" + } + ], + "text": "Internal nose structure (body structure)" + } } } }, diff --git a/backend/src/test/resources/fhir/specimen.json b/backend/src/test/resources/fhir/specimen.json index 095b26277a7..01d2b9ebadb 100644 --- a/backend/src/test/resources/fhir/specimen.json +++ b/backend/src/test/resources/fhir/specimen.json @@ -15,14 +15,14 @@ "coding": [ { "system": "http://snomed.info/sct", - "code": "10101" + "code": "53342003" } ], - "text": "nose" + "text": "Internal nose structure (body structure)" }, - "collectedDateTime":"2023-06-22T11:35:00-04:00" + "collectedDateTime": "2023-06-22T11:35:00-04:00" }, - "receivedTime":"2023-06-23T12:00:00-04:00", + "receivedTime": "2023-06-23T12:00:00-04:00", "identifier": [ { "value": "$SPECIMEN_IDENTIFIER" diff --git a/backend/src/test/resources/testResultUpload/fhir-for-csv-with-comments.ndjson b/backend/src/test/resources/testResultUpload/fhir-for-csv-with-comments.ndjson index ce0b9fc8fcd..ed752eb0c2d 100644 --- a/backend/src/test/resources/testResultUpload/fhir-for-csv-with-comments.ndjson +++ b/backend/src/test/resources/testResultUpload/fhir-for-csv-with-comments.ndjson @@ -345,7 +345,16 @@ }, "receivedTime": "2021-12-22T14:00:00-06:00", "collection": { - "collectedDateTime": "2021-12-21T14:00:00-06:00" + "collectedDateTime": "2021-12-21T14:00:00-06:00", + "bodySite": { + "coding": [ + { + "system": "http://snomed.info/sct", + "code": "53342003" + } + ], + "text": "Internal nose structure (body structure)" + } } } }, @@ -1169,7 +1178,16 @@ }, "receivedTime": "2021-12-22T14:00:00-06:00", "collection": { - "collectedDateTime": "2021-12-21T14:00:00-06:00" + "collectedDateTime": "2021-12-21T14:00:00-06:00", + "bodySite": { + "coding": [ + { + "system": "http://snomed.info/sct", + "code": "53342003" + } + ], + "text": "Internal nose structure (body structure)" + } } } }, diff --git a/backend/src/test/resources/testResultUpload/fhir-for-csv-with-flu-only.ndjson b/backend/src/test/resources/testResultUpload/fhir-for-csv-with-flu-only.ndjson index fe52a93c003..f8f9c2642b6 100644 --- a/backend/src/test/resources/testResultUpload/fhir-for-csv-with-flu-only.ndjson +++ b/backend/src/test/resources/testResultUpload/fhir-for-csv-with-flu-only.ndjson @@ -345,7 +345,16 @@ }, "receivedTime": "2021-12-20T14:00:00-06:00", "collection": { - "collectedDateTime": "2021-12-20T14:00:00-06:00" + "collectedDateTime": "2021-12-20T14:00:00-06:00", + "bodySite": { + "coding": [ + { + "system": "http://snomed.info/sct", + "code": "53342003" + } + ], + "text": "Internal nose structure (body structure)" + } } } }, diff --git a/backend/src/test/resources/testResultUpload/fhir-for-csv-with-specimenType-loinc.ndjson b/backend/src/test/resources/testResultUpload/fhir-for-csv-with-specimenType-loinc.ndjson index 0d8692314c0..708429e2f1f 100644 --- a/backend/src/test/resources/testResultUpload/fhir-for-csv-with-specimenType-loinc.ndjson +++ b/backend/src/test/resources/testResultUpload/fhir-for-csv-with-specimenType-loinc.ndjson @@ -345,7 +345,16 @@ }, "receivedTime": "2021-12-22T14:00:00-06:00", "collection": { - "collectedDateTime": "2021-12-21T14:00:00-06:00" + "collectedDateTime": "2021-12-21T14:00:00-06:00", + "bodySite": { + "coding": [ + { + "system": "http://snomed.info/sct", + "code": "53342003" + } + ], + "text": "Internal nose structure (body structure)" + } } } }, @@ -1169,7 +1178,16 @@ }, "receivedTime": "2021-12-22T14:00:00-06:00", "collection": { - "collectedDateTime": "2021-12-21T14:00:00-06:00" + "collectedDateTime": "2021-12-21T14:00:00-06:00", + "bodySite": { + "coding": [ + { + "system": "http://snomed.info/sct", + "code": "53342003" + } + ], + "text": "Internal nose structure (body structure)" + } } } }, diff --git a/backend/src/test/resources/testResultUpload/test-results-upload-valid-as-fhir.json b/backend/src/test/resources/testResultUpload/test-results-upload-valid-as-fhir.json index 7e1f0688555..2613df33342 100644 --- a/backend/src/test/resources/testResultUpload/test-results-upload-valid-as-fhir.json +++ b/backend/src/test/resources/testResultUpload/test-results-upload-valid-as-fhir.json @@ -345,7 +345,16 @@ }, "receivedTime": "2021-12-22T14:00:00-06:00", "collection": { - "collectedDateTime": "2021-12-21T14:00:00-06:00" + "collectedDateTime": "2021-12-21T14:00:00-06:00", + "bodySite": { + "coding": [ + { + "system": "http://snomed.info/sct", + "code": "53342003" + } + ], + "text": "Internal nose structure (body structure)" + } } } }, diff --git a/backend/src/test/resources/testResultUpload/test-results-upload-valid-as-fhir.ndjson b/backend/src/test/resources/testResultUpload/test-results-upload-valid-as-fhir.ndjson index 8b778efeee8..7f5bce9d4ff 100644 --- a/backend/src/test/resources/testResultUpload/test-results-upload-valid-as-fhir.ndjson +++ b/backend/src/test/resources/testResultUpload/test-results-upload-valid-as-fhir.ndjson @@ -1,6 +1,6 @@ -{"resourceType":"Bundle","identifier":{"value":"123"},"type":"message","timestamp":"2023-05-24T19:33:06.472Z","entry":[{"fullUrl":"MessageHeader/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"MessageHeader","id":"5db534ea-5e97-4861-ba18-d74acc46db15","meta":{"tag":[{"system":"http://terminology.hl7.org/CodeSystem/v2-0103","code":"P","display":"Production"}]},"eventCoding":{"system":"http://terminology.hl7.org/CodeSystem/v2-0003","code":"R01","display":"ORU/ACK - Unsolicited transmission of an observation message"},"destination":[{"name":"PRIME ReportStream","endpoint":"https://prime.cdc.gov/api/reports?option=SkipInvalidItems"}],"sender":{"reference":"Organization/12345000-0000-0000-0000-000000000000"},"source":{"extension":[{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/software-binary-id","valueString":"short-commit-id"},{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/software-install-date","valueInstant":"2023-02-08T21:33:06Z"},{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/software-vendor-org","valueReference":{"reference":"Organization/07640c5d-87cd-488b-9343-a226c5166539"}}],"software":"PRIME SimpleReport","version":"short-commit-id","endpoint":"https://simplereport.gov"},"focus":[{"reference":"Provenance/5db534ea-5e97-4861-ba18-d74acc46db15"},{"reference":"DiagnosticReport/123"}]}},{"fullUrl":"Provenance/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"Provenance","id":"5db534ea-5e97-4861-ba18-d74acc46db15","recorded":"2023-05-24T19:33:06.472Z","activity":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v2-0003","code":"R01","display":"ORU/ACK - Unsolicited transmission of an observation message"}]},"agent":[{"who":{"reference":"Organization/12345000-0000-0000-0000-000000000000"}}]}},{"fullUrl":"DiagnosticReport/123","resource":{"resourceType":"DiagnosticReport","id":"123","identifier":[{"value":"123"}],"basedOn":[{"reference":"ServiceRequest/5db534ea-5e97-4861-ba18-d74acc46db15"}],"status":"final","code":{"coding":[{"system":"http://loinc.org","code":"94534-5"}]},"subject":{"reference":"Patient/1234"},"effectiveDateTime":"2021-12-23T14:00:00-06:00","issued":"2021-12-24T14:00:00-06:00","specimen":[{"reference":"Specimen/5db534ea-5e97-4861-ba18-d74acc46db15"}],"result":[{"reference":"Observation/5db534ea-5e97-4861-ba18-d74acc46db15"}]}},{"fullUrl":"Patient/1234","resource":{"resourceType":"Patient","id":"1234","extension":[{"url":"http://ibm.com/fhir/cdm/StructureDefinition/local-race-cd","valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v3-Race","code":"2076-8"}],"text":"Native Hawaiian or Other Pacific Islander"}},{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/ethnic-group","valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v2-0189","code":"N","display":"Not Hispanic or Latino"}],"text":"Not Hispanic or Latino"}}],"identifier":[{"value":"1234"}],"name":[{"family":"Doe","given":["Jane"]}],"telecom":[{"system":"phone","value":"(205) 999 2800","use":"mobile"}],"gender":"female","birthDate":"1962-01-20","address":[{"line":["123 Main St"],"city":"Birmingham","district":"Jefferson","state":"AL","postalCode":"35226","country":"USA"}],"managingOrganization":{"reference":"Organization/12345000-0000-0000-0000-000000000000"}}},{"fullUrl":"Organization/12345000-0000-0000-0000-000000000000","resource":{"resourceType":"Organization","id":"12345000-0000-0000-0000-000000000000","identifier":[{"use":"official","type":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v2-0301","code":"CLIA"}]},"value":"01D1058442"}],"name":"My Testing Lab","telecom":[{"system":"phone","value":"(205) 888 2000","use":"work"}],"address":[{"line":["300 North Street"],"city":"Birmingham","state":"AL","postalCode":"35228","country":"USA"}]}},{"fullUrl":"Organization/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"Organization","id":"5db534ea-5e97-4861-ba18-d74acc46db15","identifier":[{"use":"official","type":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v2-0301","code":"CLIA"}]},"value":"01D1058442"}],"name":"My Urgent Care","telecom":[{"system":"phone","value":"(205) 888 2000","use":"work"}],"address":[{"line":["400 Main Street","Suite 100"],"city":"Birmingham","state":"AL","postalCode":"35228","country":"USA"}]}},{"fullUrl":"Practitioner/1013012657","resource":{"resourceType":"Practitioner","id":"1013012657","identifier":[{"system":"http://hl7.org/fhir/sid/us-npi","value":"1013012657"}],"name":[{"family":"Smith MD","given":["John"]}],"telecom":[{"system":"phone","value":"(205) 888 2000","use":"work"}],"address":[{"line":["400 Main Street"],"city":"Birmingham","state":"AL","postalCode":"35228","country":"USA"}]}},{"fullUrl":"Specimen/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"Specimen","id":"5db534ea-5e97-4861-ba18-d74acc46db15","identifier":[{"value":"5db534ea-5e97-4861-ba18-d74acc46db15"}],"type":{"coding":[{"system":"http://snomed.info/sct","code":"445297001"}],"text":"Nasal swab"},"subject":{"reference":"Patient/1234"},"receivedTime":"2021-12-22T14:00:00-06:00","collection":{"collectedDateTime":"2021-12-21T14:00:00-06:00"}}},{"fullUrl":"ServiceRequest/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"ServiceRequest","id":"5db534ea-5e97-4861-ba18-d74acc46db15","extension":[{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/order-control","valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v2-0119","code":"RE"}]}},{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/order-effective-date","valueDateTime":"2021-12-20T14:00:00-06:00"}],"status":"completed","intent":"order","code":{"coding":[{"system":"http://loinc.org","code":"94534-5"}]},"subject":{"reference":"Patient/1234"},"requester":{"reference":"PractitionerRole/5db534ea-5e97-4861-ba18-d74acc46db15"},"performer":[{"reference":"Organization/12345000-0000-0000-0000-000000000000"}],"supportingInfo":[{"reference":"Observation/7e5bdd49-f9ca-3c9c-b379-19343eac04be"},{"reference":"Observation/07099f95-8754-3317-8e87-e1c4717c1af1"},{"reference":"Observation/7cae2c8e-cc60-35f6-8980-dd6bc9e1f539"},{"reference":"Observation/4403633f-899d-3042-8a3e-863c27bd57ae"},{"reference":"Observation/b903826a-06bc-3c2d-a0e1-3b9aed860f0a"},{"reference":"Observation/585761a1-2d41-3688-b5c7-9ae8535b4a67"},{"reference":"Observation/870a2208-83f5-32a8-92e7-da4c228d7d6e"}],"note":[{"extension":[{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/note-type","valueCodeableConcept":{"coding":[{"extension":[{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/code-index-name","valueString":"identifier"}],"system":"HL70364","version":"2.5.1","code":"RE","display":"Remark"}]}}],"text":"Test Comment 1"}]}},{"fullUrl":"Device/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"Device","id":"5db534ea-5e97-4861-ba18-d74acc46db15","identifier":[{"value":"543212134"},{"type":{"coding":[{"code":"MNI"}]}}],"manufacturer":"Acme","deviceName":[{"name":"ID NOW","type":"model-name"}]}},{"fullUrl":"PractitionerRole/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"PractitionerRole","id":"5db534ea-5e97-4861-ba18-d74acc46db15","practitioner":{"reference":"Practitioner/1013012657"},"organization":{"reference":"Organization/5db534ea-5e97-4861-ba18-d74acc46db15"}}},{"fullUrl":"Organization/07640c5d-87cd-488b-9343-a226c5166539","resource":{"resourceType":"Organization","id":"07640c5d-87cd-488b-9343-a226c5166539","name":"SimpleReport"}},{"fullUrl":"Observation/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"Observation","id":"5db534ea-5e97-4861-ba18-d74acc46db15","status":"final","code":{"coding":[{"system":"http://loinc.org","code":"94534-5"}],"text":"COVID-19"},"subject":{"reference":"Patient/1234"},"issued":"2021-12-23T20:00:00.000Z","performer":[{"reference":"Organization/12345000-0000-0000-0000-000000000000"}],"valueCodeableConcept":{"coding":[{"system":"http://snomed.info/sct","code":"260373001","display":"Detected"}]},"interpretation":[{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v2-0078","code":"A","display":"Abnormal"}]}],"method":{"extension":[{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/testkit-name-id","valueCoding":{"code":"BOOMX2"}}],"coding":[{"display":"ID NOW"}]},"specimen":{"reference":"Specimen/5db534ea-5e97-4861-ba18-d74acc46db15"},"device":{"reference":"Device/5db534ea-5e97-4861-ba18-d74acc46db15"}}},{"fullUrl":"Observation/7e5bdd49-f9ca-3c9c-b379-19343eac04be","resource":{"resourceType":"Observation","id":"7e5bdd49-f9ca-3c9c-b379-19343eac04be","identifier":[{"use":"official","type":{"coding":[{"system":"http://loinc.org","code":"81959-9","display":"Public health laboratory ask at order entry panel"}]}}],"status":"final","code":{"coding":[{"system":"http://loinc.org","code":"95419-8","display":"Has symptoms related to condition of interest"}],"text":"Has symptoms related to condition of interest"},"subject":{"reference":"Patient/1234"},"valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/ValueSet/v2-0136","code":"N","display":"No"}]}}},{"fullUrl":"Observation/07099f95-8754-3317-8e87-e1c4717c1af1","resource":{"resourceType":"Observation","id":"07099f95-8754-3317-8e87-e1c4717c1af1","identifier":[{"use":"official","type":{"coding":[{"system":"http://loinc.org","code":"81959-9","display":"Public health laboratory ask at order entry panel"}]}}],"status":"final","code":{"coding":[{"system":"http://loinc.org","code":"82810-3","display":"Pregnancy status"}],"text":"Pregnancy status"},"subject":{"reference":"Patient/1234"},"valueCodeableConcept":{"coding":[{"system":"http://snomed.info/sct","code":"77386006","display":"Pregnant"}]}}},{"fullUrl":"Observation/7cae2c8e-cc60-35f6-8980-dd6bc9e1f539","resource":{"resourceType":"Observation","id":"7cae2c8e-cc60-35f6-8980-dd6bc9e1f539","identifier":[{"use":"official","type":{"coding":[{"system":"http://loinc.org","code":"81959-9","display":"Public health laboratory ask at order entry panel"}]}}],"status":"final","code":{"coding":[{"system":"http://loinc.org","code":"95418-0","display":"Employed in a healthcare setting"}],"text":"Employed in a healthcare setting"},"subject":{"reference":"Patient/1234"},"valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/ValueSet/v2-0136","code":"N","display":"No"}]}}},{"fullUrl":"Observation/4403633f-899d-3042-8a3e-863c27bd57ae","resource":{"resourceType":"Observation","id":"4403633f-899d-3042-8a3e-863c27bd57ae","identifier":[{"use":"official","type":{"coding":[{"system":"http://loinc.org","code":"81959-9","display":"Public health laboratory ask at order entry panel"}]}}],"status":"final","code":{"coding":[{"system":"http://loinc.org","code":"77974-4","display":"Hospitalized for condition"}],"text":"Hospitalized for condition"},"subject":{"reference":"Patient/1234"},"valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/ValueSet/v2-0136","code":"N","display":"No"}]}}},{"fullUrl":"Observation/b903826a-06bc-3c2d-a0e1-3b9aed860f0a","resource":{"resourceType":"Observation","id":"b903826a-06bc-3c2d-a0e1-3b9aed860f0a","identifier":[{"use":"official","type":{"coding":[{"system":"http://loinc.org","code":"81959-9","display":"Public health laboratory ask at order entry panel"}]}}],"status":"final","code":{"coding":[{"system":"http://loinc.org","code":"95420-6","display":"Admitted to ICU for condition"}],"text":"Admitted to ICU for condition"},"subject":{"reference":"Patient/1234"},"valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v3-NullFlavor","code":"UNK","display":"unknown"}]}}},{"fullUrl":"Observation/585761a1-2d41-3688-b5c7-9ae8535b4a67","resource":{"resourceType":"Observation","id":"585761a1-2d41-3688-b5c7-9ae8535b4a67","identifier":[{"use":"official","type":{"coding":[{"system":"http://loinc.org","code":"81959-9","display":"Public health laboratory ask at order entry panel"}]}}],"status":"final","code":{"coding":[{"system":"http://loinc.org","code":"95421-4","display":"Resides in a congregate care setting"}],"text":"Resides in a congregate care setting"},"subject":{"reference":"Patient/1234"},"valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/ValueSet/v2-0136","code":"Y","display":"Yes"}]}}},{"fullUrl":"Observation/870a2208-83f5-32a8-92e7-da4c228d7d6e","resource":{"resourceType":"Observation","id":"870a2208-83f5-32a8-92e7-da4c228d7d6e","identifier":[{"use":"official","type":{"coding":[{"system":"http://loinc.org","code":"81959-9","display":"Public health laboratory ask at order entry panel"}]}}],"status":"final","code":{"coding":[{"system":"http://loinc.org","code":"75617-1","display":"Residence"}],"text":"Residence"},"subject":{"reference":"Patient/1234"},"valueCodeableConcept":{"coding":[{"system":"http://snomed.info/sct","code":"30629002","display":"retirement home"}]}}}]} -{"resourceType":"Bundle","identifier":{"value":"234"},"type":"message","timestamp":"2023-05-24T19:33:06.472Z","entry":[{"fullUrl":"MessageHeader/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"MessageHeader","id":"5db534ea-5e97-4861-ba18-d74acc46db15","meta":{"tag":[{"system":"http://terminology.hl7.org/CodeSystem/v2-0103","code":"P","display":"Production"}]},"eventCoding":{"system":"http://terminology.hl7.org/CodeSystem/v2-0003","code":"R01","display":"ORU/ACK - Unsolicited transmission of an observation message"},"destination":[{"name":"PRIME ReportStream","endpoint":"https://prime.cdc.gov/api/reports?option=SkipInvalidItems"}],"sender":{"reference":"Organization/12345000-0000-0000-0000-000000000000"},"source":{"extension":[{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/software-binary-id","valueString":"short-commit-id"},{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/software-install-date","valueInstant":"2023-02-08T21:33:06Z"},{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/software-vendor-org","valueReference":{"reference":"Organization/07640c5d-87cd-488b-9343-a226c5166539"}}],"software":"PRIME SimpleReport","version":"short-commit-id","endpoint":"https://simplereport.gov"},"focus":[{"reference":"Provenance/5db534ea-5e97-4861-ba18-d74acc46db15"},{"reference":"DiagnosticReport/234"}]}},{"fullUrl":"Provenance/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"Provenance","id":"5db534ea-5e97-4861-ba18-d74acc46db15","recorded":"2023-05-24T19:33:06.472Z","activity":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v2-0003","code":"R01","display":"ORU/ACK - Unsolicited transmission of an observation message"}]},"agent":[{"who":{"reference":"Organization/12345000-0000-0000-0000-000000000000"}}]}},{"fullUrl":"DiagnosticReport/234","resource":{"resourceType":"DiagnosticReport","id":"234","identifier":[{"value":"234"}],"basedOn":[{"reference":"ServiceRequest/5db534ea-5e97-4861-ba18-d74acc46db15"}],"status":"final","code":{"coding":[{"system":"http://loinc.org","code":"94534-5"}]},"subject":{"reference":"Patient/2345"},"effectiveDateTime":"2021-12-23T14:00:00-06:00","issued":"2021-12-24T14:00:00-06:00","specimen":[{"reference":"Specimen/5db534ea-5e97-4861-ba18-d74acc46db15"}],"result":[{"reference":"Observation/5db534ea-5e97-4861-ba18-d74acc46db15"}]}},{"fullUrl":"Patient/2345","resource":{"resourceType":"Patient","id":"2345","extension":[{"url":"http://ibm.com/fhir/cdm/StructureDefinition/local-race-cd","valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v3-Race","code":"2106-3"}],"text":"White"}},{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/ethnic-group","valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v2-0189","code":"H","display":"Hispanic or Latino"}],"text":"Hispanic or Latino"}}],"identifier":[{"value":"2345"}],"name":[{"family":"Doe","given":["Jayne"]}],"telecom":[{"system":"phone","value":"(205) 999 2800","use":"mobile"}],"gender":"female","birthDate":"1962-01-20","address":[{"line":["123 Main St"],"city":"Birmingham","district":"Jefferson","state":"AL","postalCode":"35226","country":"USA"}],"managingOrganization":{"reference":"Organization/12345000-0000-0000-0000-000000000000"}}},{"fullUrl":"Organization/12345000-0000-0000-0000-000000000000","resource":{"resourceType":"Organization","id":"12345000-0000-0000-0000-000000000000","identifier":[{"use":"official","type":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v2-0301","code":"CLIA"}]},"value":"01D1058442"}],"name":"My Testing Lab","telecom":[{"system":"phone","value":"(205) 888 2000","use":"work"}],"address":[{"line":["300 North Street"],"city":"Birmingham","state":"AL","postalCode":"35228","country":"USA"}]}},{"fullUrl":"Organization/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"Organization","id":"5db534ea-5e97-4861-ba18-d74acc46db15","identifier":[{"use":"official","type":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v2-0301","code":"CLIA"}]},"value":"01D1058442"}],"name":"My Urgent Care","telecom":[{"system":"phone","value":"(205) 888 2000","use":"work"}],"address":[{"line":["400 Main Street","Suite 100"],"city":"Birmingham","state":"AL","postalCode":"35228","country":"USA"}]}},{"fullUrl":"Practitioner/1013012657","resource":{"resourceType":"Practitioner","id":"1013012657","identifier":[{"system":"http://hl7.org/fhir/sid/us-npi","value":"1013012657"}],"name":[{"family":"Smith MD","given":["John"]}],"telecom":[{"system":"phone","value":"(205) 888 2000","use":"work"}],"address":[{"line":["400 Main Street"],"city":"Birmingham","state":"AL","postalCode":"35228","country":"USA"}]}},{"fullUrl":"Specimen/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"Specimen","id":"5db534ea-5e97-4861-ba18-d74acc46db15","identifier":[{"value":"5db534ea-5e97-4861-ba18-d74acc46db15"}],"type":{"coding":[{"system":"http://snomed.info/sct","code":"445297001"}],"text":"Nasal swab"},"subject":{"reference":"Patient/2345"},"receivedTime":"2021-12-22T14:00:00-06:00","collection":{"collectedDateTime":"2021-12-21T14:00:00-06:00"}}},{"fullUrl":"ServiceRequest/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"ServiceRequest","id":"5db534ea-5e97-4861-ba18-d74acc46db15","extension":[{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/order-control","valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v2-0119","code":"RE"}]}},{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/order-effective-date","valueDateTime":"2021-12-20T14:00:00-06:00"}],"status":"completed","intent":"order","code":{"coding":[{"system":"http://loinc.org","code":"94534-5"}]},"subject":{"reference":"Patient/2345"},"requester":{"reference":"PractitionerRole/5db534ea-5e97-4861-ba18-d74acc46db15"},"performer":[{"reference":"Organization/12345000-0000-0000-0000-000000000000"}],"supportingInfo":[{"reference":"Observation/3dadfd89-ab2a-3f34-ab90-60180a5c7b9d"},{"reference":"Observation/07099f95-8754-3317-8e87-e1c4717c1af1"},{"reference":"Observation/7cae2c8e-cc60-35f6-8980-dd6bc9e1f539"},{"reference":"Observation/4403633f-899d-3042-8a3e-863c27bd57ae"},{"reference":"Observation/b903826a-06bc-3c2d-a0e1-3b9aed860f0a"},{"reference":"Observation/585761a1-2d41-3688-b5c7-9ae8535b4a67"},{"reference":"Observation/870a2208-83f5-32a8-92e7-da4c228d7d6e"}],"note":[{"extension":[{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/note-type","valueCodeableConcept":{"coding":[{"extension":[{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/code-index-name","valueString":"identifier"}],"system":"HL70364","version":"2.5.1","code":"RE","display":"Remark"}]}}],"text":"Test Comment 2"}]}},{"fullUrl":"Device/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"Device","id":"5db534ea-5e97-4861-ba18-d74acc46db15","identifier":[{"value":"543212134"},{"type":{"coding":[{"code":"MNI"}]}}],"manufacturer":"Acme","deviceName":[{"name":"ID NOW","type":"model-name"}]}},{"fullUrl":"PractitionerRole/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"PractitionerRole","id":"5db534ea-5e97-4861-ba18-d74acc46db15","practitioner":{"reference":"Practitioner/1013012657"},"organization":{"reference":"Organization/5db534ea-5e97-4861-ba18-d74acc46db15"}}},{"fullUrl":"Organization/07640c5d-87cd-488b-9343-a226c5166539","resource":{"resourceType":"Organization","id":"07640c5d-87cd-488b-9343-a226c5166539","name":"SimpleReport"}},{"fullUrl":"Observation/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"Observation","id":"5db534ea-5e97-4861-ba18-d74acc46db15","status":"final","code":{"coding":[{"system":"http://loinc.org","code":"94534-5"}],"text":"COVID-19"},"subject":{"reference":"Patient/2345"},"issued":"2021-12-23T20:00:00.000Z","performer":[{"reference":"Organization/12345000-0000-0000-0000-000000000000"}],"valueCodeableConcept":{"coding":[{"system":"http://snomed.info/sct","code":"260415000","display":"Not detected"}]},"interpretation":[{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v2-0078","code":"N","display":"Normal"}]}],"method":{"extension":[{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/testkit-name-id","valueCoding":{"code":"BOOMX2"}}],"coding":[{"display":"ID NOW"}]},"specimen":{"reference":"Specimen/5db534ea-5e97-4861-ba18-d74acc46db15"},"device":{"reference":"Device/5db534ea-5e97-4861-ba18-d74acc46db15"}}},{"fullUrl":"Observation/3dadfd89-ab2a-3f34-ab90-60180a5c7b9d","resource":{"resourceType":"Observation","id":"3dadfd89-ab2a-3f34-ab90-60180a5c7b9d","identifier":[{"use":"official","type":{"coding":[{"system":"http://loinc.org","code":"81959-9","display":"Public health laboratory ask at order entry panel"}]}}],"status":"final","code":{"coding":[{"system":"http://loinc.org","code":"95419-8","display":"Has symptoms related to condition of interest"}],"text":"Has symptoms related to condition of interest"},"subject":{"reference":"Patient/2345"},"valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/ValueSet/v2-0136","code":"N","display":"No"}]}}},{"fullUrl":"Observation/07099f95-8754-3317-8e87-e1c4717c1af1","resource":{"resourceType":"Observation","id":"07099f95-8754-3317-8e87-e1c4717c1af1","identifier":[{"use":"official","type":{"coding":[{"system":"http://loinc.org","code":"81959-9","display":"Public health laboratory ask at order entry panel"}]}}],"status":"final","code":{"coding":[{"system":"http://loinc.org","code":"82810-3","display":"Pregnancy status"}],"text":"Pregnancy status"},"subject":{"reference":"Patient/2345"},"valueCodeableConcept":{"coding":[{"system":"http://snomed.info/sct","code":"60001007","display":"Not pregnant"}]}}},{"fullUrl":"Observation/7cae2c8e-cc60-35f6-8980-dd6bc9e1f539","resource":{"resourceType":"Observation","id":"7cae2c8e-cc60-35f6-8980-dd6bc9e1f539","identifier":[{"use":"official","type":{"coding":[{"system":"http://loinc.org","code":"81959-9","display":"Public health laboratory ask at order entry panel"}]}}],"status":"final","code":{"coding":[{"system":"http://loinc.org","code":"95418-0","display":"Employed in a healthcare setting"}],"text":"Employed in a healthcare setting"},"subject":{"reference":"Patient/2345"},"valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/ValueSet/v2-0136","code":"Y","display":"Yes"}]}}},{"fullUrl":"Observation/4403633f-899d-3042-8a3e-863c27bd57ae","resource":{"resourceType":"Observation","id":"4403633f-899d-3042-8a3e-863c27bd57ae","identifier":[{"use":"official","type":{"coding":[{"system":"http://loinc.org","code":"81959-9","display":"Public health laboratory ask at order entry panel"}]}}],"status":"final","code":{"coding":[{"system":"http://loinc.org","code":"77974-4","display":"Hospitalized for condition"}],"text":"Hospitalized for condition"},"subject":{"reference":"Patient/2345"},"valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v3-NullFlavor","code":"UNK","display":"unknown"}]}}},{"fullUrl":"Observation/b903826a-06bc-3c2d-a0e1-3b9aed860f0a","resource":{"resourceType":"Observation","id":"b903826a-06bc-3c2d-a0e1-3b9aed860f0a","identifier":[{"use":"official","type":{"coding":[{"system":"http://loinc.org","code":"81959-9","display":"Public health laboratory ask at order entry panel"}]}}],"status":"final","code":{"coding":[{"system":"http://loinc.org","code":"95420-6","display":"Admitted to ICU for condition"}],"text":"Admitted to ICU for condition"},"subject":{"reference":"Patient/2345"},"valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/ValueSet/v2-0136","code":"N","display":"No"}]}}},{"fullUrl":"Observation/585761a1-2d41-3688-b5c7-9ae8535b4a67","resource":{"resourceType":"Observation","id":"585761a1-2d41-3688-b5c7-9ae8535b4a67","identifier":[{"use":"official","type":{"coding":[{"system":"http://loinc.org","code":"81959-9","display":"Public health laboratory ask at order entry panel"}]}}],"status":"final","code":{"coding":[{"system":"http://loinc.org","code":"95421-4","display":"Resides in a congregate care setting"}],"text":"Resides in a congregate care setting"},"subject":{"reference":"Patient/2345"},"valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/ValueSet/v2-0136","code":"Y","display":"Yes"}]}}},{"fullUrl":"Observation/870a2208-83f5-32a8-92e7-da4c228d7d6e","resource":{"resourceType":"Observation","id":"870a2208-83f5-32a8-92e7-da4c228d7d6e","identifier":[{"use":"official","type":{"coding":[{"system":"http://loinc.org","code":"81959-9","display":"Public health laboratory ask at order entry panel"}]}}],"status":"final","code":{"coding":[{"system":"http://loinc.org","code":"75617-1","display":"Residence"}],"text":"Residence"},"subject":{"reference":"Patient/2345"},"valueCodeableConcept":{"coding":[{"system":"http://snomed.info/sct","code":"224683003","display":"military accommodation"}]}}}]} -{"resourceType":"Bundle","identifier":{"value":"345"},"type":"message","timestamp":"2023-05-24T19:33:06.472Z","entry":[{"fullUrl":"MessageHeader/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"MessageHeader","id":"5db534ea-5e97-4861-ba18-d74acc46db15","meta":{"tag":[{"system":"http://terminology.hl7.org/CodeSystem/v2-0103","code":"P","display":"Production"}]},"eventCoding":{"system":"http://terminology.hl7.org/CodeSystem/v2-0003","code":"R01","display":"ORU/ACK - Unsolicited transmission of an observation message"},"destination":[{"name":"PRIME ReportStream","endpoint":"https://prime.cdc.gov/api/reports?option=SkipInvalidItems"}],"sender":{"reference":"Organization/12345000-0000-0000-0000-000000000000"},"source":{"extension":[{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/software-binary-id","valueString":"short-commit-id"},{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/software-install-date","valueInstant":"2023-02-08T21:33:06Z"},{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/software-vendor-org","valueReference":{"reference":"Organization/07640c5d-87cd-488b-9343-a226c5166539"}}],"software":"PRIME SimpleReport","version":"short-commit-id","endpoint":"https://simplereport.gov"},"focus":[{"reference":"Provenance/5db534ea-5e97-4861-ba18-d74acc46db15"},{"reference":"DiagnosticReport/345"}]}},{"fullUrl":"Provenance/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"Provenance","id":"5db534ea-5e97-4861-ba18-d74acc46db15","recorded":"2023-05-24T19:33:06.472Z","activity":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v2-0003","code":"R01","display":"ORU/ACK - Unsolicited transmission of an observation message"}]},"agent":[{"who":{"reference":"Organization/12345000-0000-0000-0000-000000000000"}}]}},{"fullUrl":"DiagnosticReport/345","resource":{"resourceType":"DiagnosticReport","id":"345","identifier":[{"value":"345"}],"basedOn":[{"reference":"ServiceRequest/5db534ea-5e97-4861-ba18-d74acc46db15"}],"status":"final","code":{"coding":[{"system":"http://loinc.org","code":"94534-5"}]},"subject":{"reference":"Patient/3456"},"effectiveDateTime":"2021-12-23T14:00:00-06:00","issued":"2021-12-24T14:00:00-06:00","specimen":[{"reference":"Specimen/5db534ea-5e97-4861-ba18-d74acc46db15"}],"result":[{"reference":"Observation/5db534ea-5e97-4861-ba18-d74acc46db15"}]}},{"fullUrl":"Patient/3456","resource":{"resourceType":"Patient","id":"3456","extension":[{"url":"http://ibm.com/fhir/cdm/StructureDefinition/local-race-cd","valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v3-Race","code":"2028-9"}],"text":"Asian"}},{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/ethnic-group","valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v2-0189","code":"N","display":"Not Hispanic or Latino"}],"text":"Not Hispanic or Latino"}}],"identifier":[{"value":"3456"}],"name":[{"family":"Doe","given":["Jan"]}],"telecom":[{"system":"phone","value":"(205) 999 2800","use":"mobile"}],"gender":"female","birthDate":"1962-01-20","address":[{"line":["123 Main St"],"city":"Birmingham","district":"Jefferson","state":"AL","postalCode":"35226","country":"USA"}],"managingOrganization":{"reference":"Organization/12345000-0000-0000-0000-000000000000"}}},{"fullUrl":"Organization/12345000-0000-0000-0000-000000000000","resource":{"resourceType":"Organization","id":"12345000-0000-0000-0000-000000000000","identifier":[{"use":"official","type":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v2-0301","code":"CLIA"}]},"value":"01D1058442"}],"name":"My Testing Lab","telecom":[{"system":"phone","value":"(205) 888 2000","use":"work"}],"address":[{"line":["300 North Street"],"city":"Birmingham","state":"AL","postalCode":"35228","country":"USA"}]}},{"fullUrl":"Organization/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"Organization","id":"5db534ea-5e97-4861-ba18-d74acc46db15","identifier":[{"use":"official","type":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v2-0301","code":"CLIA"}]},"value":"01D1058442"}],"name":"My Urgent Care","telecom":[{"system":"phone","value":"(205) 888 2000","use":"work"}],"address":[{"line":["400 Main Street","Suite 100"],"city":"Birmingham","state":"AL","postalCode":"35228","country":"USA"}]}},{"fullUrl":"Practitioner/1013012657","resource":{"resourceType":"Practitioner","id":"1013012657","identifier":[{"system":"http://hl7.org/fhir/sid/us-npi","value":"1013012657"}],"name":[{"family":"Smith MD","given":["John"]}],"telecom":[{"system":"phone","value":"(205) 888 2000","use":"work"}],"address":[{"line":["400 Main Street"],"city":"Birmingham","state":"AL","postalCode":"35228","country":"USA"}]}},{"fullUrl":"Specimen/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"Specimen","id":"5db534ea-5e97-4861-ba18-d74acc46db15","identifier":[{"value":"5db534ea-5e97-4861-ba18-d74acc46db15"}],"type":{"coding":[{"system":"http://snomed.info/sct","code":"445297001"}],"text":"Nasal swab"},"subject":{"reference":"Patient/3456"},"receivedTime":"2021-12-22T14:00:00-06:00","collection":{"collectedDateTime":"2021-12-21T14:00:00-06:00"}}},{"fullUrl":"ServiceRequest/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"ServiceRequest","id":"5db534ea-5e97-4861-ba18-d74acc46db15","extension":[{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/order-control","valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v2-0119","code":"RE"}]}},{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/order-effective-date","valueDateTime":"2021-12-20T14:00:00-06:00"}],"status":"completed","intent":"order","code":{"coding":[{"system":"http://loinc.org","code":"94534-5"}]},"subject":{"reference":"Patient/3456"},"requester":{"reference":"PractitionerRole/5db534ea-5e97-4861-ba18-d74acc46db15"},"performer":[{"reference":"Organization/12345000-0000-0000-0000-000000000000"}],"supportingInfo":[{"reference":"Observation/b24ef60b-fd2c-3987-9263-e27b7c5788ea"},{"reference":"Observation/07099f95-8754-3317-8e87-e1c4717c1af1"},{"reference":"Observation/7cae2c8e-cc60-35f6-8980-dd6bc9e1f539"},{"reference":"Observation/4403633f-899d-3042-8a3e-863c27bd57ae"},{"reference":"Observation/b903826a-06bc-3c2d-a0e1-3b9aed860f0a"},{"reference":"Observation/585761a1-2d41-3688-b5c7-9ae8535b4a67"}],"note":[{"extension":[{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/note-type","valueCodeableConcept":{"coding":[{"extension":[{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/code-index-name","valueString":"identifier"}],"system":"HL70364","version":"2.5.1","code":"RE","display":"Remark"}]}}],"text":"Test Comment 3"}]}},{"fullUrl":"Device/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"Device","id":"5db534ea-5e97-4861-ba18-d74acc46db15","identifier":[{"value":"543212134"},{"type":{"coding":[{"code":"MNI"}]}}],"manufacturer":"Acme","deviceName":[{"name":"ID NOW","type":"model-name"}]}},{"fullUrl":"PractitionerRole/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"PractitionerRole","id":"5db534ea-5e97-4861-ba18-d74acc46db15","practitioner":{"reference":"Practitioner/1013012657"},"organization":{"reference":"Organization/5db534ea-5e97-4861-ba18-d74acc46db15"}}},{"fullUrl":"Organization/07640c5d-87cd-488b-9343-a226c5166539","resource":{"resourceType":"Organization","id":"07640c5d-87cd-488b-9343-a226c5166539","name":"SimpleReport"}},{"fullUrl":"Observation/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"Observation","id":"5db534ea-5e97-4861-ba18-d74acc46db15","status":"final","code":{"coding":[{"system":"http://loinc.org","code":"94534-5"}],"text":"COVID-19"},"subject":{"reference":"Patient/3456"},"issued":"2021-12-23T20:00:00.000Z","performer":[{"reference":"Organization/12345000-0000-0000-0000-000000000000"}],"valueCodeableConcept":{"coding":[{"system":"http://snomed.info/sct","code":"260373001","display":"Detected"}]},"interpretation":[{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v2-0078","code":"A","display":"Abnormal"}]}],"method":{"extension":[{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/testkit-name-id","valueCoding":{"code":"BOOMX2"}}],"coding":[{"display":"ID NOW"}]},"specimen":{"reference":"Specimen/5db534ea-5e97-4861-ba18-d74acc46db15"},"device":{"reference":"Device/5db534ea-5e97-4861-ba18-d74acc46db15"}}},{"fullUrl":"Observation/b24ef60b-fd2c-3987-9263-e27b7c5788ea","resource":{"resourceType":"Observation","id":"b24ef60b-fd2c-3987-9263-e27b7c5788ea","identifier":[{"use":"official","type":{"coding":[{"system":"http://loinc.org","code":"81959-9","display":"Public health laboratory ask at order entry panel"}]}}],"status":"final","code":{"coding":[{"system":"http://loinc.org","code":"95419-8","display":"Has symptoms related to condition of interest"}],"text":"Has symptoms related to condition of interest"},"subject":{"reference":"Patient/3456"},"valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/ValueSet/v2-0136","code":"N","display":"No"}]}}},{"fullUrl":"Observation/07099f95-8754-3317-8e87-e1c4717c1af1","resource":{"resourceType":"Observation","id":"07099f95-8754-3317-8e87-e1c4717c1af1","identifier":[{"use":"official","type":{"coding":[{"system":"http://loinc.org","code":"81959-9","display":"Public health laboratory ask at order entry panel"}]}}],"status":"final","code":{"coding":[{"system":"http://loinc.org","code":"82810-3","display":"Pregnancy status"}],"text":"Pregnancy status"},"subject":{"reference":"Patient/3456"},"valueCodeableConcept":{"coding":[{"system":"http://snomed.info/sct","code":"60001007","display":"Not pregnant"}]}}},{"fullUrl":"Observation/7cae2c8e-cc60-35f6-8980-dd6bc9e1f539","resource":{"resourceType":"Observation","id":"7cae2c8e-cc60-35f6-8980-dd6bc9e1f539","identifier":[{"use":"official","type":{"coding":[{"system":"http://loinc.org","code":"81959-9","display":"Public health laboratory ask at order entry panel"}]}}],"status":"final","code":{"coding":[{"system":"http://loinc.org","code":"95418-0","display":"Employed in a healthcare setting"}],"text":"Employed in a healthcare setting"},"subject":{"reference":"Patient/3456"},"valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v3-NullFlavor","code":"UNK","display":"unknown"}]}}},{"fullUrl":"Observation/4403633f-899d-3042-8a3e-863c27bd57ae","resource":{"resourceType":"Observation","id":"4403633f-899d-3042-8a3e-863c27bd57ae","identifier":[{"use":"official","type":{"coding":[{"system":"http://loinc.org","code":"81959-9","display":"Public health laboratory ask at order entry panel"}]}}],"status":"final","code":{"coding":[{"system":"http://loinc.org","code":"77974-4","display":"Hospitalized for condition"}],"text":"Hospitalized for condition"},"subject":{"reference":"Patient/3456"},"valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/ValueSet/v2-0136","code":"N","display":"No"}]}}},{"fullUrl":"Observation/b903826a-06bc-3c2d-a0e1-3b9aed860f0a","resource":{"resourceType":"Observation","id":"b903826a-06bc-3c2d-a0e1-3b9aed860f0a","identifier":[{"use":"official","type":{"coding":[{"system":"http://loinc.org","code":"81959-9","display":"Public health laboratory ask at order entry panel"}]}}],"status":"final","code":{"coding":[{"system":"http://loinc.org","code":"95420-6","display":"Admitted to ICU for condition"}],"text":"Admitted to ICU for condition"},"subject":{"reference":"Patient/3456"},"valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/ValueSet/v2-0136","code":"Y","display":"Yes"}]}}},{"fullUrl":"Observation/585761a1-2d41-3688-b5c7-9ae8535b4a67","resource":{"resourceType":"Observation","id":"585761a1-2d41-3688-b5c7-9ae8535b4a67","identifier":[{"use":"official","type":{"coding":[{"system":"http://loinc.org","code":"81959-9","display":"Public health laboratory ask at order entry panel"}]}}],"status":"final","code":{"coding":[{"system":"http://loinc.org","code":"95421-4","display":"Resides in a congregate care setting"}],"text":"Resides in a congregate care setting"},"subject":{"reference":"Patient/3456"},"valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/ValueSet/v2-0136","code":"N","display":"No"}]}}}]} -{"resourceType":"Bundle","identifier":{"value":"456"},"type":"message","timestamp":"2023-05-24T19:33:06.472Z","entry":[{"fullUrl":"MessageHeader/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"MessageHeader","id":"5db534ea-5e97-4861-ba18-d74acc46db15","meta":{"tag":[{"system":"http://terminology.hl7.org/CodeSystem/v2-0103","code":"P","display":"Production"}]},"eventCoding":{"system":"http://terminology.hl7.org/CodeSystem/v2-0003","code":"R01","display":"ORU/ACK - Unsolicited transmission of an observation message"},"destination":[{"name":"PRIME ReportStream","endpoint":"https://prime.cdc.gov/api/reports?option=SkipInvalidItems"}],"sender":{"reference":"Organization/12345000-0000-0000-0000-000000000000"},"source":{"extension":[{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/software-binary-id","valueString":"short-commit-id"},{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/software-install-date","valueInstant":"2023-02-08T21:33:06Z"},{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/software-vendor-org","valueReference":{"reference":"Organization/07640c5d-87cd-488b-9343-a226c5166539"}}],"software":"PRIME SimpleReport","version":"short-commit-id","endpoint":"https://simplereport.gov"},"focus":[{"reference":"Provenance/5db534ea-5e97-4861-ba18-d74acc46db15"},{"reference":"DiagnosticReport/456"}]}},{"fullUrl":"Provenance/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"Provenance","id":"5db534ea-5e97-4861-ba18-d74acc46db15","recorded":"2023-05-24T19:33:06.472Z","activity":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v2-0003","code":"R01","display":"ORU/ACK - Unsolicited transmission of an observation message"}]},"agent":[{"who":{"reference":"Organization/12345000-0000-0000-0000-000000000000"}}]}},{"fullUrl":"DiagnosticReport/456","resource":{"resourceType":"DiagnosticReport","id":"456","identifier":[{"value":"456"}],"basedOn":[{"reference":"ServiceRequest/5db534ea-5e97-4861-ba18-d74acc46db15"}],"status":"final","code":{"coding":[{"system":"http://loinc.org","code":"94534-5"}]},"subject":{"reference":"Patient/4567"},"effectiveDateTime":"2021-12-23T14:00:00-06:00","issued":"2021-12-24T14:00:00-06:00","specimen":[{"reference":"Specimen/5db534ea-5e97-4861-ba18-d74acc46db15"}],"result":[{"reference":"Observation/5db534ea-5e97-4861-ba18-d74acc46db15"}]}},{"fullUrl":"Patient/4567","resource":{"resourceType":"Patient","id":"4567","extension":[{"url":"http://ibm.com/fhir/cdm/StructureDefinition/local-race-cd","valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v3-Race","code":"2054-5"}],"text":"Black or African American"}},{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/ethnic-group","valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v2-0189","code":"H","display":"Hispanic or Latino"}],"text":"Hispanic or Latino"}}],"identifier":[{"value":"4567"}],"name":[{"family":"Doe","given":["Jayn"]}],"telecom":[{"system":"phone","value":"(205) 999 2800","use":"mobile"}],"gender":"female","birthDate":"1962-01-20","address":[{"line":["123 Main St"],"city":"Birmingham","district":"Jefferson","state":"AL","postalCode":"35226","country":"USA"}],"managingOrganization":{"reference":"Organization/12345000-0000-0000-0000-000000000000"}}},{"fullUrl":"Organization/12345000-0000-0000-0000-000000000000","resource":{"resourceType":"Organization","id":"12345000-0000-0000-0000-000000000000","identifier":[{"use":"official","type":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v2-0301","code":"CLIA"}]},"value":"01D1058442"}],"name":"My Testing Lab","telecom":[{"system":"phone","value":"(205) 888 2000","use":"work"}],"address":[{"line":["300 North Street"],"city":"Birmingham","state":"AL","postalCode":"35228","country":"USA"}]}},{"fullUrl":"Organization/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"Organization","id":"5db534ea-5e97-4861-ba18-d74acc46db15","identifier":[{"use":"official","type":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v2-0301","code":"CLIA"}]},"value":"01D1058442"}],"name":"My Urgent Care","telecom":[{"system":"phone","value":"(205) 888 2000","use":"work"}],"address":[{"line":["400 Main Street","Suite 100"],"city":"Birmingham","state":"AL","postalCode":"35228","country":"USA"}]}},{"fullUrl":"Practitioner/1013012657","resource":{"resourceType":"Practitioner","id":"1013012657","identifier":[{"system":"http://hl7.org/fhir/sid/us-npi","value":"1013012657"}],"name":[{"family":"Smith MD","given":["John"]}],"telecom":[{"system":"phone","value":"(205) 888 2000","use":"work"}],"address":[{"line":["400 Main Street"],"city":"Birmingham","state":"AL","postalCode":"35228","country":"USA"}]}},{"fullUrl":"Specimen/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"Specimen","id":"5db534ea-5e97-4861-ba18-d74acc46db15","identifier":[{"value":"5db534ea-5e97-4861-ba18-d74acc46db15"}],"type":{"coding":[{"system":"http://snomed.info/sct","code":"445297001"}],"text":"Nasal swab"},"subject":{"reference":"Patient/4567"},"receivedTime":"2021-12-22T14:00:00-06:00","collection":{"collectedDateTime":"2021-12-21T14:00:00-06:00"}}},{"fullUrl":"ServiceRequest/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"ServiceRequest","id":"5db534ea-5e97-4861-ba18-d74acc46db15","extension":[{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/order-control","valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v2-0119","code":"RE"}]}},{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/order-effective-date","valueDateTime":"2021-12-20T14:00:00-06:00"}],"status":"completed","intent":"order","code":{"coding":[{"system":"http://loinc.org","code":"94534-5"}]},"subject":{"reference":"Patient/4567"},"requester":{"reference":"PractitionerRole/5db534ea-5e97-4861-ba18-d74acc46db15"},"performer":[{"reference":"Organization/12345000-0000-0000-0000-000000000000"}],"supportingInfo":[{"reference":"Observation/9456e7bb-dbe3-359f-abaa-e8c731fab37d"},{"reference":"Observation/f907292f-dde0-3d9d-a03c-f744f4d1e92a"},{"reference":"Observation/07099f95-8754-3317-8e87-e1c4717c1af1"},{"reference":"Observation/7cae2c8e-cc60-35f6-8980-dd6bc9e1f539"},{"reference":"Observation/4403633f-899d-3042-8a3e-863c27bd57ae"},{"reference":"Observation/b903826a-06bc-3c2d-a0e1-3b9aed860f0a"},{"reference":"Observation/585761a1-2d41-3688-b5c7-9ae8535b4a67"}],"note":[{"extension":[{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/note-type","valueCodeableConcept":{"coding":[{"extension":[{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/code-index-name","valueString":"identifier"}],"system":"HL70364","version":"2.5.1","code":"RE","display":"Remark"}]}}],"text":"Test Comment 4"}]}},{"fullUrl":"Device/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"Device","id":"5db534ea-5e97-4861-ba18-d74acc46db15","identifier":[{"value":"543212134"},{"type":{"coding":[{"code":"MNI"}]}}],"manufacturer":"Acme","deviceName":[{"name":"ID NOW","type":"model-name"}]}},{"fullUrl":"PractitionerRole/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"PractitionerRole","id":"5db534ea-5e97-4861-ba18-d74acc46db15","practitioner":{"reference":"Practitioner/1013012657"},"organization":{"reference":"Organization/5db534ea-5e97-4861-ba18-d74acc46db15"}}},{"fullUrl":"Organization/07640c5d-87cd-488b-9343-a226c5166539","resource":{"resourceType":"Organization","id":"07640c5d-87cd-488b-9343-a226c5166539","name":"SimpleReport"}},{"fullUrl":"Observation/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"Observation","id":"5db534ea-5e97-4861-ba18-d74acc46db15","status":"final","code":{"coding":[{"system":"http://loinc.org","code":"94534-5"}],"text":"COVID-19"},"subject":{"reference":"Patient/4567"},"issued":"2021-12-23T20:00:00.000Z","performer":[{"reference":"Organization/12345000-0000-0000-0000-000000000000"}],"valueCodeableConcept":{"coding":[{"system":"http://snomed.info/sct","code":"260415000","display":"Not detected"}]},"interpretation":[{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v2-0078","code":"N","display":"Normal"}]}],"method":{"extension":[{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/testkit-name-id","valueCoding":{"code":"BOOMX2"}}],"coding":[{"display":"ID NOW"}]},"specimen":{"reference":"Specimen/5db534ea-5e97-4861-ba18-d74acc46db15"},"device":{"reference":"Device/5db534ea-5e97-4861-ba18-d74acc46db15"}}},{"fullUrl":"Observation/9456e7bb-dbe3-359f-abaa-e8c731fab37d","resource":{"resourceType":"Observation","id":"9456e7bb-dbe3-359f-abaa-e8c731fab37d","identifier":[{"use":"official","type":{"coding":[{"system":"http://loinc.org","code":"81959-9","display":"Public health laboratory ask at order entry panel"}]}}],"status":"final","code":{"coding":[{"system":"http://loinc.org","code":"95419-8","display":"Has symptoms related to condition of interest"}],"text":"Has symptoms related to condition of interest"},"subject":{"reference":"Patient/4567"},"valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/ValueSet/v2-0136","code":"Y","display":"Yes"}]}}},{"fullUrl":"Observation/f907292f-dde0-3d9d-a03c-f744f4d1e92a","resource":{"resourceType":"Observation","id":"f907292f-dde0-3d9d-a03c-f744f4d1e92a","identifier":[{"use":"official","type":{"coding":[{"system":"http://loinc.org","code":"81959-9","display":"Public health laboratory ask at order entry panel"}]}}],"status":"final","code":{"coding":[{"system":"http://loinc.org","code":"11368-8","display":"Illness or injury onset date and time"}],"text":"Illness or injury onset date and time"},"subject":{"reference":"Patient/4567"},"valueDateTime":"2020-01-01"}},{"fullUrl":"Observation/07099f95-8754-3317-8e87-e1c4717c1af1","resource":{"resourceType":"Observation","id":"07099f95-8754-3317-8e87-e1c4717c1af1","identifier":[{"use":"official","type":{"coding":[{"system":"http://loinc.org","code":"81959-9","display":"Public health laboratory ask at order entry panel"}]}}],"status":"final","code":{"coding":[{"system":"http://loinc.org","code":"82810-3","display":"Pregnancy status"}],"text":"Pregnancy status"},"subject":{"reference":"Patient/4567"},"valueCodeableConcept":{"coding":[{"system":"http://snomed.info/sct","code":"60001007","display":"Not pregnant"}]}}},{"fullUrl":"Observation/7cae2c8e-cc60-35f6-8980-dd6bc9e1f539","resource":{"resourceType":"Observation","id":"7cae2c8e-cc60-35f6-8980-dd6bc9e1f539","identifier":[{"use":"official","type":{"coding":[{"system":"http://loinc.org","code":"81959-9","display":"Public health laboratory ask at order entry panel"}]}}],"status":"final","code":{"coding":[{"system":"http://loinc.org","code":"95418-0","display":"Employed in a healthcare setting"}],"text":"Employed in a healthcare setting"},"subject":{"reference":"Patient/4567"},"valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/ValueSet/v2-0136","code":"N","display":"No"}]}}},{"fullUrl":"Observation/4403633f-899d-3042-8a3e-863c27bd57ae","resource":{"resourceType":"Observation","id":"4403633f-899d-3042-8a3e-863c27bd57ae","identifier":[{"use":"official","type":{"coding":[{"system":"http://loinc.org","code":"81959-9","display":"Public health laboratory ask at order entry panel"}]}}],"status":"final","code":{"coding":[{"system":"http://loinc.org","code":"77974-4","display":"Hospitalized for condition"}],"text":"Hospitalized for condition"},"subject":{"reference":"Patient/4567"},"valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/ValueSet/v2-0136","code":"N","display":"No"}]}}},{"fullUrl":"Observation/b903826a-06bc-3c2d-a0e1-3b9aed860f0a","resource":{"resourceType":"Observation","id":"b903826a-06bc-3c2d-a0e1-3b9aed860f0a","identifier":[{"use":"official","type":{"coding":[{"system":"http://loinc.org","code":"81959-9","display":"Public health laboratory ask at order entry panel"}]}}],"status":"final","code":{"coding":[{"system":"http://loinc.org","code":"95420-6","display":"Admitted to ICU for condition"}],"text":"Admitted to ICU for condition"},"subject":{"reference":"Patient/4567"},"valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/ValueSet/v2-0136","code":"N","display":"No"}]}}},{"fullUrl":"Observation/585761a1-2d41-3688-b5c7-9ae8535b4a67","resource":{"resourceType":"Observation","id":"585761a1-2d41-3688-b5c7-9ae8535b4a67","identifier":[{"use":"official","type":{"coding":[{"system":"http://loinc.org","code":"81959-9","display":"Public health laboratory ask at order entry panel"}]}}],"status":"final","code":{"coding":[{"system":"http://loinc.org","code":"95421-4","display":"Resides in a congregate care setting"}],"text":"Resides in a congregate care setting"},"subject":{"reference":"Patient/4567"},"valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/ValueSet/v2-0136","code":"N","display":"No"}]}}}]} -{"resourceType":"Bundle","identifier":{"value":"567"},"type":"message","timestamp":"2023-05-24T19:33:06.472Z","entry":[{"fullUrl":"MessageHeader/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"MessageHeader","id":"5db534ea-5e97-4861-ba18-d74acc46db15","meta":{"tag":[{"system":"http://terminology.hl7.org/CodeSystem/v2-0103","code":"P","display":"Production"}]},"eventCoding":{"system":"http://terminology.hl7.org/CodeSystem/v2-0003","code":"R01","display":"ORU/ACK - Unsolicited transmission of an observation message"},"destination":[{"name":"PRIME ReportStream","endpoint":"https://prime.cdc.gov/api/reports?option=SkipInvalidItems"}],"sender":{"reference":"Organization/12345000-0000-0000-0000-000000000000"},"source":{"extension":[{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/software-binary-id","valueString":"short-commit-id"},{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/software-install-date","valueInstant":"2023-02-08T21:33:06Z"},{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/software-vendor-org","valueReference":{"reference":"Organization/07640c5d-87cd-488b-9343-a226c5166539"}}],"software":"PRIME SimpleReport","version":"short-commit-id","endpoint":"https://simplereport.gov"},"focus":[{"reference":"Provenance/5db534ea-5e97-4861-ba18-d74acc46db15"},{"reference":"DiagnosticReport/567"}]}},{"fullUrl":"Provenance/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"Provenance","id":"5db534ea-5e97-4861-ba18-d74acc46db15","recorded":"2023-05-24T19:33:06.472Z","activity":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v2-0003","code":"R01","display":"ORU/ACK - Unsolicited transmission of an observation message"}]},"agent":[{"who":{"reference":"Organization/12345000-0000-0000-0000-000000000000"}}]}},{"fullUrl":"DiagnosticReport/567","resource":{"resourceType":"DiagnosticReport","id":"567","identifier":[{"value":"567"}],"basedOn":[{"reference":"ServiceRequest/5db534ea-5e97-4861-ba18-d74acc46db15"}],"status":"final","code":{"coding":[{"system":"http://loinc.org","code":"94534-5"}]},"subject":{"reference":"Patient/4567"},"effectiveDateTime":"2021-12-23T14:00:00-06:00","issued":"2021-12-24T14:00:00-06:00","specimen":[{"reference":"Specimen/5db534ea-5e97-4861-ba18-d74acc46db15"}],"result":[{"reference":"Observation/5db534ea-5e97-4861-ba18-d74acc46db15"}]}},{"fullUrl":"Patient/4567","resource":{"resourceType":"Patient","id":"4567","extension":[{"url":"http://ibm.com/fhir/cdm/StructureDefinition/local-race-cd","valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v3-NullFlavor","code":"UNK"}],"text":"Unknown"}},{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/ethnic-group","valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v2-0189","code":"U","display":"unknown"}],"text":"unknown"}}],"identifier":[{"value":"4567"}],"name":[{"family":"Doe","given":["Janey"]}],"telecom":[{"system":"phone","value":"(205) 999 2800","use":"mobile"}],"gender":"female","birthDate":"1962-01-20","address":[{"line":["123 Main St"],"city":"Birmingham","district":"Jefferson","state":"AL","postalCode":"35226","country":"USA"}],"managingOrganization":{"reference":"Organization/12345000-0000-0000-0000-000000000000"}}},{"fullUrl":"Organization/12345000-0000-0000-0000-000000000000","resource":{"resourceType":"Organization","id":"12345000-0000-0000-0000-000000000000","identifier":[{"use":"official","type":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v2-0301","code":"CLIA"}]},"value":"01D1058442"}],"name":"My Testing Lab","telecom":[{"system":"phone","value":"(205) 888 2000","use":"work"}],"address":[{"line":["300 North Street"],"city":"Birmingham","state":"AL","postalCode":"35228","country":"USA"}]}},{"fullUrl":"Organization/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"Organization","id":"5db534ea-5e97-4861-ba18-d74acc46db15","identifier":[{"use":"official","type":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v2-0301","code":"CLIA"}]},"value":"01D1058442"}],"name":"My Urgent Care","telecom":[{"system":"phone","value":"(205) 888 2000","use":"work"}],"address":[{"line":["400 Main Street","Suite 100"],"city":"Birmingham","state":"AL","postalCode":"35228","country":"USA"}]}},{"fullUrl":"Practitioner/1013012657","resource":{"resourceType":"Practitioner","id":"1013012657","identifier":[{"system":"http://hl7.org/fhir/sid/us-npi","value":"1013012657"}],"name":[{"family":"Smith MD","given":["John"]}],"telecom":[{"system":"phone","value":"(205) 888 2000","use":"work"}],"address":[{"line":["400 Main Street"],"city":"Birmingham","state":"AL","postalCode":"35228","country":"USA"}]}},{"fullUrl":"Specimen/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"Specimen","id":"5db534ea-5e97-4861-ba18-d74acc46db15","identifier":[{"value":"5db534ea-5e97-4861-ba18-d74acc46db15"}],"type":{"coding":[{"system":"http://snomed.info/sct","code":"445297001"}],"text":"Nasal swab"},"subject":{"reference":"Patient/4567"},"receivedTime":"2021-12-22T14:00:00-06:00","collection":{"collectedDateTime":"2021-12-21T14:00:00-06:00"}}},{"fullUrl":"ServiceRequest/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"ServiceRequest","id":"5db534ea-5e97-4861-ba18-d74acc46db15","extension":[{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/order-control","valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v2-0119","code":"RE"}]}},{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/order-effective-date","valueDateTime":"2021-12-20T14:00:00-06:00"}],"status":"completed","intent":"order","code":{"coding":[{"system":"http://loinc.org","code":"94534-5"}]},"subject":{"reference":"Patient/4567"},"requester":{"reference":"PractitionerRole/5db534ea-5e97-4861-ba18-d74acc46db15"},"performer":[{"reference":"Organization/12345000-0000-0000-0000-000000000000"}],"supportingInfo":[{"reference":"Observation/b1e252e3-6d94-3123-91f5-2df61a166812"},{"reference":"Observation/07099f95-8754-3317-8e87-e1c4717c1af1"},{"reference":"Observation/7cae2c8e-cc60-35f6-8980-dd6bc9e1f539"},{"reference":"Observation/4403633f-899d-3042-8a3e-863c27bd57ae"},{"reference":"Observation/b903826a-06bc-3c2d-a0e1-3b9aed860f0a"},{"reference":"Observation/585761a1-2d41-3688-b5c7-9ae8535b4a67"}],"note":[{"extension":[{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/note-type","valueCodeableConcept":{"coding":[{"extension":[{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/code-index-name","valueString":"identifier"}],"system":"HL70364","version":"2.5.1","code":"RE","display":"Remark"}]}}],"text":"Test Comment 5"}]}},{"fullUrl":"Device/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"Device","id":"5db534ea-5e97-4861-ba18-d74acc46db15","identifier":[{"value":"543212134"},{"type":{"coding":[{"code":"MNI"}]}}],"manufacturer":"Acme","deviceName":[{"name":"ID NOW","type":"model-name"}]}},{"fullUrl":"PractitionerRole/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"PractitionerRole","id":"5db534ea-5e97-4861-ba18-d74acc46db15","practitioner":{"reference":"Practitioner/1013012657"},"organization":{"reference":"Organization/5db534ea-5e97-4861-ba18-d74acc46db15"}}},{"fullUrl":"Organization/07640c5d-87cd-488b-9343-a226c5166539","resource":{"resourceType":"Organization","id":"07640c5d-87cd-488b-9343-a226c5166539","name":"SimpleReport"}},{"fullUrl":"Observation/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"Observation","id":"5db534ea-5e97-4861-ba18-d74acc46db15","status":"final","code":{"coding":[{"system":"http://loinc.org","code":"94534-5"}],"text":"COVID-19"},"subject":{"reference":"Patient/4567"},"issued":"2021-12-23T20:00:00.000Z","performer":[{"reference":"Organization/12345000-0000-0000-0000-000000000000"}],"valueCodeableConcept":{"coding":[{"system":"http://snomed.info/sct","code":"455371000124106","display":"Invalid result"}]},"interpretation":[{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v2-0078","code":"N","display":"Normal"}]}],"method":{"extension":[{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/testkit-name-id","valueCoding":{"code":"BOOMX2"}}],"coding":[{"display":"ID NOW"}]},"specimen":{"reference":"Specimen/5db534ea-5e97-4861-ba18-d74acc46db15"},"device":{"reference":"Device/5db534ea-5e97-4861-ba18-d74acc46db15"}}},{"fullUrl":"Observation/b1e252e3-6d94-3123-91f5-2df61a166812","resource":{"resourceType":"Observation","id":"b1e252e3-6d94-3123-91f5-2df61a166812","identifier":[{"use":"official","type":{"coding":[{"system":"http://loinc.org","code":"81959-9","display":"Public health laboratory ask at order entry panel"}]}}],"status":"final","code":{"coding":[{"system":"http://loinc.org","code":"95419-8","display":"Has symptoms related to condition of interest"}],"text":"Has symptoms related to condition of interest"},"subject":{"reference":"Patient/4567"},"valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/ValueSet/v2-0136","code":"N","display":"No"}]}}},{"fullUrl":"Observation/07099f95-8754-3317-8e87-e1c4717c1af1","resource":{"resourceType":"Observation","id":"07099f95-8754-3317-8e87-e1c4717c1af1","identifier":[{"use":"official","type":{"coding":[{"system":"http://loinc.org","code":"81959-9","display":"Public health laboratory ask at order entry panel"}]}}],"status":"final","code":{"coding":[{"system":"http://loinc.org","code":"82810-3","display":"Pregnancy status"}],"text":"Pregnancy status"},"subject":{"reference":"Patient/4567"},"valueCodeableConcept":{"coding":[{"system":"http://snomed.info/sct","code":"102874004","display":"Unknown"}]}}},{"fullUrl":"Observation/7cae2c8e-cc60-35f6-8980-dd6bc9e1f539","resource":{"resourceType":"Observation","id":"7cae2c8e-cc60-35f6-8980-dd6bc9e1f539","identifier":[{"use":"official","type":{"coding":[{"system":"http://loinc.org","code":"81959-9","display":"Public health laboratory ask at order entry panel"}]}}],"status":"final","code":{"coding":[{"system":"http://loinc.org","code":"95418-0","display":"Employed in a healthcare setting"}],"text":"Employed in a healthcare setting"},"subject":{"reference":"Patient/4567"},"valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/ValueSet/v2-0136","code":"N","display":"No"}]}}},{"fullUrl":"Observation/4403633f-899d-3042-8a3e-863c27bd57ae","resource":{"resourceType":"Observation","id":"4403633f-899d-3042-8a3e-863c27bd57ae","identifier":[{"use":"official","type":{"coding":[{"system":"http://loinc.org","code":"81959-9","display":"Public health laboratory ask at order entry panel"}]}}],"status":"final","code":{"coding":[{"system":"http://loinc.org","code":"77974-4","display":"Hospitalized for condition"}],"text":"Hospitalized for condition"},"subject":{"reference":"Patient/4567"},"valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/ValueSet/v2-0136","code":"Y","display":"Yes"}]}}},{"fullUrl":"Observation/b903826a-06bc-3c2d-a0e1-3b9aed860f0a","resource":{"resourceType":"Observation","id":"b903826a-06bc-3c2d-a0e1-3b9aed860f0a","identifier":[{"use":"official","type":{"coding":[{"system":"http://loinc.org","code":"81959-9","display":"Public health laboratory ask at order entry panel"}]}}],"status":"final","code":{"coding":[{"system":"http://loinc.org","code":"95420-6","display":"Admitted to ICU for condition"}],"text":"Admitted to ICU for condition"},"subject":{"reference":"Patient/4567"},"valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/ValueSet/v2-0136","code":"N","display":"No"}]}}},{"fullUrl":"Observation/585761a1-2d41-3688-b5c7-9ae8535b4a67","resource":{"resourceType":"Observation","id":"585761a1-2d41-3688-b5c7-9ae8535b4a67","identifier":[{"use":"official","type":{"coding":[{"system":"http://loinc.org","code":"81959-9","display":"Public health laboratory ask at order entry panel"}]}}],"status":"final","code":{"coding":[{"system":"http://loinc.org","code":"95421-4","display":"Resides in a congregate care setting"}],"text":"Resides in a congregate care setting"},"subject":{"reference":"Patient/4567"},"valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v3-NullFlavor","code":"UNK","display":"unknown"}]}}}]} -{"resourceType":"Bundle","identifier":{"value":"678"},"type":"message","timestamp":"2023-05-24T19:33:06.472Z","entry":[{"fullUrl":"MessageHeader/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"MessageHeader","id":"5db534ea-5e97-4861-ba18-d74acc46db15","meta":{"tag":[{"system":"http://terminology.hl7.org/CodeSystem/v2-0103","code":"P","display":"Production"}]},"eventCoding":{"system":"http://terminology.hl7.org/CodeSystem/v2-0003","code":"R01","display":"ORU/ACK - Unsolicited transmission of an observation message"},"destination":[{"name":"PRIME ReportStream","endpoint":"https://prime.cdc.gov/api/reports?option=SkipInvalidItems"}],"sender":{"reference":"Organization/12345000-0000-0000-0000-000000000000"},"source":{"extension":[{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/software-binary-id","valueString":"short-commit-id"},{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/software-install-date","valueInstant":"2023-02-08T21:33:06Z"},{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/software-vendor-org","valueReference":{"reference":"Organization/07640c5d-87cd-488b-9343-a226c5166539"}}],"software":"PRIME SimpleReport","version":"short-commit-id","endpoint":"https://simplereport.gov"},"focus":[{"reference":"Provenance/5db534ea-5e97-4861-ba18-d74acc46db15"},{"reference":"DiagnosticReport/678"}]}},{"fullUrl":"Provenance/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"Provenance","id":"5db534ea-5e97-4861-ba18-d74acc46db15","recorded":"2023-05-24T19:33:06.472Z","activity":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v2-0003","code":"R01","display":"ORU/ACK - Unsolicited transmission of an observation message"}]},"agent":[{"who":{"reference":"Organization/12345000-0000-0000-0000-000000000000"}}]}},{"fullUrl":"DiagnosticReport/678","resource":{"resourceType":"DiagnosticReport","id":"678","identifier":[{"value":"678"}],"basedOn":[{"reference":"ServiceRequest/5db534ea-5e97-4861-ba18-d74acc46db15"}],"status":"final","code":{"coding":[{"system":"http://loinc.org","code":"94534-5"}]},"subject":{"reference":"Patient/4567"},"effectiveDateTime":"2021-12-23T14:00:00-06:00","issued":"2021-12-24T14:00:00-06:00","specimen":[{"reference":"Specimen/5db534ea-5e97-4861-ba18-d74acc46db15"}],"result":[{"reference":"Observation/5db534ea-5e97-4861-ba18-d74acc46db15"}]}},{"fullUrl":"Patient/4567","resource":{"resourceType":"Patient","id":"4567","extension":[{"url":"http://ibm.com/fhir/cdm/StructureDefinition/local-race-cd","valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v3-Race","code":"2131-1"}],"text":"other"}},{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/ethnic-group","valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v2-0189","code":"N","display":"Not Hispanic or Latino"}],"text":"Not Hispanic or Latino"}}],"identifier":[{"value":"4567"}],"name":[{"family":"Doe","given":["Janey"]}],"telecom":[{"system":"phone","value":"(205) 999 2800","use":"mobile"}],"gender":"female","birthDate":"1962-01-20","address":[{"line":["123 Main St"],"city":"Birmingham","district":"Jefferson","state":"AL","postalCode":"35226","country":"USA"}],"managingOrganization":{"reference":"Organization/12345000-0000-0000-0000-000000000000"}}},{"fullUrl":"Organization/12345000-0000-0000-0000-000000000000","resource":{"resourceType":"Organization","id":"12345000-0000-0000-0000-000000000000","identifier":[{"use":"official","type":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v2-0301","code":"CLIA"}]},"value":"01D1058442"}],"name":"My Testing Lab","telecom":[{"system":"phone","value":"(205) 888 2000","use":"work"}],"address":[{"line":["300 North Street"],"city":"Birmingham","state":"AL","postalCode":"35228","country":"USA"}]}},{"fullUrl":"Organization/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"Organization","id":"5db534ea-5e97-4861-ba18-d74acc46db15","identifier":[{"use":"official","type":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v2-0301","code":"CLIA"}]},"value":"01D1058442"}],"name":"My Urgent Care","telecom":[{"system":"phone","value":"(205) 888 2000","use":"work"}],"address":[{"line":["400 Main Street","Suite 100"],"city":"Birmingham","state":"AL","postalCode":"35228","country":"USA"}]}},{"fullUrl":"Practitioner/1013012657","resource":{"resourceType":"Practitioner","id":"1013012657","identifier":[{"system":"http://hl7.org/fhir/sid/us-npi","value":"1013012657"}],"name":[{"family":"Smith MD","given":["John"]}],"telecom":[{"system":"phone","value":"(205) 888 2000","use":"work"}],"address":[{"line":["400 Main Street"],"city":"Birmingham","state":"AL","postalCode":"35228","country":"USA"}]}},{"fullUrl":"Specimen/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"Specimen","id":"5db534ea-5e97-4861-ba18-d74acc46db15","identifier":[{"value":"5db534ea-5e97-4861-ba18-d74acc46db15"}],"type":{"coding":[{"system":"http://snomed.info/sct","code":"445297001"}],"text":"Nasal swab"},"subject":{"reference":"Patient/4567"},"receivedTime":"2021-12-22T14:00:00-06:00","collection":{"collectedDateTime":"2021-12-21T14:00:00-06:00"}}},{"fullUrl":"ServiceRequest/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"ServiceRequest","id":"5db534ea-5e97-4861-ba18-d74acc46db15","extension":[{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/order-control","valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v2-0119","code":"RE"}]}},{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/order-effective-date","valueDateTime":"2021-12-20T14:00:00-06:00"}],"status":"completed","intent":"order","code":{"coding":[{"system":"http://loinc.org","code":"94534-5"}]},"subject":{"reference":"Patient/4567"},"requester":{"reference":"PractitionerRole/5db534ea-5e97-4861-ba18-d74acc46db15"},"performer":[{"reference":"Organization/12345000-0000-0000-0000-000000000000"}],"supportingInfo":[{"reference":"Observation/a65bbde7-854d-3151-b46b-731badba996b"},{"reference":"Observation/07099f95-8754-3317-8e87-e1c4717c1af1"},{"reference":"Observation/7cae2c8e-cc60-35f6-8980-dd6bc9e1f539"},{"reference":"Observation/4403633f-899d-3042-8a3e-863c27bd57ae"},{"reference":"Observation/b903826a-06bc-3c2d-a0e1-3b9aed860f0a"},{"reference":"Observation/585761a1-2d41-3688-b5c7-9ae8535b4a67"}],"note":[{"extension":[{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/note-type","valueCodeableConcept":{"coding":[{"extension":[{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/code-index-name","valueString":"identifier"}],"system":"HL70364","version":"2.5.1","code":"RE","display":"Remark"}]}}],"text":"Test Comment 6"}]}},{"fullUrl":"Device/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"Device","id":"5db534ea-5e97-4861-ba18-d74acc46db15","identifier":[{"value":"543212134"},{"type":{"coding":[{"code":"MNI"}]}}],"manufacturer":"Acme","deviceName":[{"name":"ID NOW","type":"model-name"}]}},{"fullUrl":"PractitionerRole/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"PractitionerRole","id":"5db534ea-5e97-4861-ba18-d74acc46db15","practitioner":{"reference":"Practitioner/1013012657"},"organization":{"reference":"Organization/5db534ea-5e97-4861-ba18-d74acc46db15"}}},{"fullUrl":"Organization/07640c5d-87cd-488b-9343-a226c5166539","resource":{"resourceType":"Organization","id":"07640c5d-87cd-488b-9343-a226c5166539","name":"SimpleReport"}},{"fullUrl":"Observation/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"Observation","id":"5db534ea-5e97-4861-ba18-d74acc46db15","status":"final","code":{"coding":[{"system":"http://loinc.org","code":"94534-5"}],"text":"COVID-19"},"subject":{"reference":"Patient/4567"},"issued":"2021-12-23T20:00:00.000Z","performer":[{"reference":"Organization/12345000-0000-0000-0000-000000000000"}],"valueCodeableConcept":{"coding":[{"system":"http://snomed.info/sct","code":"260373001","display":"Detected"}]},"interpretation":[{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v2-0078","code":"A","display":"Abnormal"}]}],"method":{"extension":[{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/testkit-name-id","valueCoding":{"code":"BOOMX2"}}],"coding":[{"display":"ID NOW"}]},"specimen":{"reference":"Specimen/5db534ea-5e97-4861-ba18-d74acc46db15"},"device":{"reference":"Device/5db534ea-5e97-4861-ba18-d74acc46db15"}}},{"fullUrl":"Observation/a65bbde7-854d-3151-b46b-731badba996b","resource":{"resourceType":"Observation","id":"a65bbde7-854d-3151-b46b-731badba996b","identifier":[{"use":"official","type":{"coding":[{"system":"http://loinc.org","code":"81959-9","display":"Public health laboratory ask at order entry panel"}]}}],"status":"final","code":{"coding":[{"system":"http://loinc.org","code":"95419-8","display":"Has symptoms related to condition of interest"}],"text":"Has symptoms related to condition of interest"},"subject":{"reference":"Patient/4567"},"valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v3-NullFlavor","code":"UNK","display":"unknown"}]}}},{"fullUrl":"Observation/07099f95-8754-3317-8e87-e1c4717c1af1","resource":{"resourceType":"Observation","id":"07099f95-8754-3317-8e87-e1c4717c1af1","identifier":[{"use":"official","type":{"coding":[{"system":"http://loinc.org","code":"81959-9","display":"Public health laboratory ask at order entry panel"}]}}],"status":"final","code":{"coding":[{"system":"http://loinc.org","code":"82810-3","display":"Pregnancy status"}],"text":"Pregnancy status"},"subject":{"reference":"Patient/4567"},"valueCodeableConcept":{"coding":[{"system":"http://snomed.info/sct","code":"60001007","display":"Not pregnant"}]}}},{"fullUrl":"Observation/7cae2c8e-cc60-35f6-8980-dd6bc9e1f539","resource":{"resourceType":"Observation","id":"7cae2c8e-cc60-35f6-8980-dd6bc9e1f539","identifier":[{"use":"official","type":{"coding":[{"system":"http://loinc.org","code":"81959-9","display":"Public health laboratory ask at order entry panel"}]}}],"status":"final","code":{"coding":[{"system":"http://loinc.org","code":"95418-0","display":"Employed in a healthcare setting"}],"text":"Employed in a healthcare setting"},"subject":{"reference":"Patient/4567"},"valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/ValueSet/v2-0136","code":"N","display":"No"}]}}},{"fullUrl":"Observation/4403633f-899d-3042-8a3e-863c27bd57ae","resource":{"resourceType":"Observation","id":"4403633f-899d-3042-8a3e-863c27bd57ae","identifier":[{"use":"official","type":{"coding":[{"system":"http://loinc.org","code":"81959-9","display":"Public health laboratory ask at order entry panel"}]}}],"status":"final","code":{"coding":[{"system":"http://loinc.org","code":"77974-4","display":"Hospitalized for condition"}],"text":"Hospitalized for condition"},"subject":{"reference":"Patient/4567"},"valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/ValueSet/v2-0136","code":"N","display":"No"}]}}},{"fullUrl":"Observation/b903826a-06bc-3c2d-a0e1-3b9aed860f0a","resource":{"resourceType":"Observation","id":"b903826a-06bc-3c2d-a0e1-3b9aed860f0a","identifier":[{"use":"official","type":{"coding":[{"system":"http://loinc.org","code":"81959-9","display":"Public health laboratory ask at order entry panel"}]}}],"status":"final","code":{"coding":[{"system":"http://loinc.org","code":"95420-6","display":"Admitted to ICU for condition"}],"text":"Admitted to ICU for condition"},"subject":{"reference":"Patient/4567"},"valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/ValueSet/v2-0136","code":"N","display":"No"}]}}},{"fullUrl":"Observation/585761a1-2d41-3688-b5c7-9ae8535b4a67","resource":{"resourceType":"Observation","id":"585761a1-2d41-3688-b5c7-9ae8535b4a67","identifier":[{"use":"official","type":{"coding":[{"system":"http://loinc.org","code":"81959-9","display":"Public health laboratory ask at order entry panel"}]}}],"status":"final","code":{"coding":[{"system":"http://loinc.org","code":"95421-4","display":"Resides in a congregate care setting"}],"text":"Resides in a congregate care setting"},"subject":{"reference":"Patient/4567"},"valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/ValueSet/v2-0136","code":"N","display":"No"}]}}}]} \ No newline at end of file +{"resourceType":"Bundle","identifier":{"value":"123"},"type":"message","timestamp":"2023-05-24T19:33:06.472Z","entry":[{"fullUrl":"MessageHeader/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"MessageHeader","id":"5db534ea-5e97-4861-ba18-d74acc46db15","meta":{"tag":[{"system":"http://terminology.hl7.org/CodeSystem/v2-0103","code":"P","display":"Production"}]},"eventCoding":{"system":"http://terminology.hl7.org/CodeSystem/v2-0003","code":"R01","display":"ORU/ACK - Unsolicited transmission of an observation message"},"destination":[{"name":"PRIME ReportStream","endpoint":"https://prime.cdc.gov/api/reports?option=SkipInvalidItems"}],"sender":{"reference":"Organization/12345000-0000-0000-0000-000000000000"},"source":{"extension":[{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/software-binary-id","valueString":"short-commit-id"},{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/software-install-date","valueInstant":"2023-02-08T21:33:06Z"},{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/software-vendor-org","valueReference":{"reference":"Organization/07640c5d-87cd-488b-9343-a226c5166539"}}],"software":"PRIME SimpleReport","version":"short-commit-id","endpoint":"https://simplereport.gov"},"focus":[{"reference":"Provenance/5db534ea-5e97-4861-ba18-d74acc46db15"},{"reference":"DiagnosticReport/123"}]}},{"fullUrl":"Provenance/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"Provenance","id":"5db534ea-5e97-4861-ba18-d74acc46db15","recorded":"2023-05-24T19:33:06.472Z","activity":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v2-0003","code":"R01","display":"ORU/ACK - Unsolicited transmission of an observation message"}]},"agent":[{"who":{"reference":"Organization/12345000-0000-0000-0000-000000000000"}}]}},{"fullUrl":"DiagnosticReport/123","resource":{"resourceType":"DiagnosticReport","id":"123","identifier":[{"value":"123"}],"basedOn":[{"reference":"ServiceRequest/5db534ea-5e97-4861-ba18-d74acc46db15"}],"status":"final","code":{"coding":[{"system":"http://loinc.org","code":"94534-5"}]},"subject":{"reference":"Patient/1234"},"effectiveDateTime":"2021-12-23T14:00:00-06:00","issued":"2021-12-24T14:00:00-06:00","specimen":[{"reference":"Specimen/5db534ea-5e97-4861-ba18-d74acc46db15"}],"result":[{"reference":"Observation/5db534ea-5e97-4861-ba18-d74acc46db15"}]}},{"fullUrl":"Patient/1234","resource":{"resourceType":"Patient","id":"1234","extension":[{"url":"http://ibm.com/fhir/cdm/StructureDefinition/local-race-cd","valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v3-Race","code":"2076-8"}],"text":"Native Hawaiian or Other Pacific Islander"}},{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/ethnic-group","valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v2-0189","code":"N","display":"Not Hispanic or Latino"}],"text":"Not Hispanic or Latino"}}],"identifier":[{"value":"1234"}],"name":[{"family":"Doe","given":["Jane"]}],"telecom":[{"system":"phone","value":"(205) 999 2800","use":"mobile"}],"gender":"female","birthDate":"1962-01-20","address":[{"line":["123 Main St"],"city":"Birmingham","district":"Jefferson","state":"AL","postalCode":"35226","country":"USA"}],"managingOrganization":{"reference":"Organization/12345000-0000-0000-0000-000000000000"}}},{"fullUrl":"Organization/12345000-0000-0000-0000-000000000000","resource":{"resourceType":"Organization","id":"12345000-0000-0000-0000-000000000000","identifier":[{"use":"official","type":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v2-0301","code":"CLIA"}]},"value":"01D1058442"}],"name":"My Testing Lab","telecom":[{"system":"phone","value":"(205) 888 2000","use":"work"}],"address":[{"line":["300 North Street"],"city":"Birmingham","state":"AL","postalCode":"35228","country":"USA"}]}},{"fullUrl":"Organization/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"Organization","id":"5db534ea-5e97-4861-ba18-d74acc46db15","identifier":[{"use":"official","type":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v2-0301","code":"CLIA"}]},"value":"01D1058442"}],"name":"My Urgent Care","telecom":[{"system":"phone","value":"(205) 888 2000","use":"work"}],"address":[{"line":["400 Main Street","Suite 100"],"city":"Birmingham","state":"AL","postalCode":"35228","country":"USA"}]}},{"fullUrl":"Practitioner/1013012657","resource":{"resourceType":"Practitioner","id":"1013012657","identifier":[{"system":"http://hl7.org/fhir/sid/us-npi","value":"1013012657"}],"name":[{"family":"Smith MD","given":["John"]}],"telecom":[{"system":"phone","value":"(205) 888 2000","use":"work"}],"address":[{"line":["400 Main Street"],"city":"Birmingham","state":"AL","postalCode":"35228","country":"USA"}]}},{"fullUrl":"Specimen/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"Specimen","id":"5db534ea-5e97-4861-ba18-d74acc46db15","identifier":[{"value":"5db534ea-5e97-4861-ba18-d74acc46db15"}],"type":{"coding":[{"system":"http://snomed.info/sct","code":"445297001"}],"text":"Nasal swab"},"subject":{"reference":"Patient/1234"},"receivedTime":"2021-12-22T14:00:00-06:00","collection":{"collectedDateTime":"2021-12-21T14:00:00-06:00","bodySite":{"coding":[{"system":"http://snomed.info/sct","code":"53342003"}],"text":"Internal nose structure (body structure)"}}}},{"fullUrl":"ServiceRequest/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"ServiceRequest","id":"5db534ea-5e97-4861-ba18-d74acc46db15","extension":[{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/order-control","valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v2-0119","code":"RE"}]}},{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/order-effective-date","valueDateTime":"2021-12-20T14:00:00-06:00"}],"status":"completed","intent":"order","code":{"coding":[{"system":"http://loinc.org","code":"94534-5"}]},"subject":{"reference":"Patient/1234"},"requester":{"reference":"PractitionerRole/5db534ea-5e97-4861-ba18-d74acc46db15"},"performer":[{"reference":"Organization/12345000-0000-0000-0000-000000000000"}],"supportingInfo":[{"reference":"Observation/7e5bdd49-f9ca-3c9c-b379-19343eac04be"},{"reference":"Observation/07099f95-8754-3317-8e87-e1c4717c1af1"},{"reference":"Observation/7cae2c8e-cc60-35f6-8980-dd6bc9e1f539"},{"reference":"Observation/4403633f-899d-3042-8a3e-863c27bd57ae"},{"reference":"Observation/b903826a-06bc-3c2d-a0e1-3b9aed860f0a"},{"reference":"Observation/585761a1-2d41-3688-b5c7-9ae8535b4a67"},{"reference":"Observation/870a2208-83f5-32a8-92e7-da4c228d7d6e"}],"note":[{"extension":[{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/note-type","valueCodeableConcept":{"coding":[{"extension":[{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/code-index-name","valueString":"identifier"}],"system":"HL70364","version":"2.5.1","code":"RE","display":"Remark"}]}}],"text":"Test Comment 1"}]}},{"fullUrl":"Device/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"Device","id":"5db534ea-5e97-4861-ba18-d74acc46db15","identifier":[{"value":"543212134"},{"type":{"coding":[{"code":"MNI"}]}}],"manufacturer":"Acme","deviceName":[{"name":"ID NOW","type":"model-name"}]}},{"fullUrl":"PractitionerRole/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"PractitionerRole","id":"5db534ea-5e97-4861-ba18-d74acc46db15","practitioner":{"reference":"Practitioner/1013012657"},"organization":{"reference":"Organization/5db534ea-5e97-4861-ba18-d74acc46db15"}}},{"fullUrl":"Organization/07640c5d-87cd-488b-9343-a226c5166539","resource":{"resourceType":"Organization","id":"07640c5d-87cd-488b-9343-a226c5166539","name":"SimpleReport"}},{"fullUrl":"Observation/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"Observation","id":"5db534ea-5e97-4861-ba18-d74acc46db15","status":"final","code":{"coding":[{"system":"http://loinc.org","code":"94534-5"}],"text":"COVID-19"},"subject":{"reference":"Patient/1234"},"issued":"2021-12-23T20:00:00.000Z","performer":[{"reference":"Organization/12345000-0000-0000-0000-000000000000"}],"valueCodeableConcept":{"coding":[{"system":"http://snomed.info/sct","code":"260373001","display":"Detected"}]},"interpretation":[{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v2-0078","code":"A","display":"Abnormal"}]}],"method":{"extension":[{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/testkit-name-id","valueCoding":{"code":"BOOMX2"}}],"coding":[{"display":"ID NOW"}]},"specimen":{"reference":"Specimen/5db534ea-5e97-4861-ba18-d74acc46db15"},"device":{"reference":"Device/5db534ea-5e97-4861-ba18-d74acc46db15"}}},{"fullUrl":"Observation/7e5bdd49-f9ca-3c9c-b379-19343eac04be","resource":{"resourceType":"Observation","id":"7e5bdd49-f9ca-3c9c-b379-19343eac04be","identifier":[{"use":"official","type":{"coding":[{"system":"http://loinc.org","code":"81959-9","display":"Public health laboratory ask at order entry panel"}]}}],"status":"final","code":{"coding":[{"system":"http://loinc.org","code":"95419-8","display":"Has symptoms related to condition of interest"}],"text":"Has symptoms related to condition of interest"},"subject":{"reference":"Patient/1234"},"valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/ValueSet/v2-0136","code":"N","display":"No"}]}}},{"fullUrl":"Observation/07099f95-8754-3317-8e87-e1c4717c1af1","resource":{"resourceType":"Observation","id":"07099f95-8754-3317-8e87-e1c4717c1af1","identifier":[{"use":"official","type":{"coding":[{"system":"http://loinc.org","code":"81959-9","display":"Public health laboratory ask at order entry panel"}]}}],"status":"final","code":{"coding":[{"system":"http://loinc.org","code":"82810-3","display":"Pregnancy status"}],"text":"Pregnancy status"},"subject":{"reference":"Patient/1234"},"valueCodeableConcept":{"coding":[{"system":"http://snomed.info/sct","code":"77386006","display":"Pregnant"}]}}},{"fullUrl":"Observation/7cae2c8e-cc60-35f6-8980-dd6bc9e1f539","resource":{"resourceType":"Observation","id":"7cae2c8e-cc60-35f6-8980-dd6bc9e1f539","identifier":[{"use":"official","type":{"coding":[{"system":"http://loinc.org","code":"81959-9","display":"Public health laboratory ask at order entry panel"}]}}],"status":"final","code":{"coding":[{"system":"http://loinc.org","code":"95418-0","display":"Employed in a healthcare setting"}],"text":"Employed in a healthcare setting"},"subject":{"reference":"Patient/1234"},"valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/ValueSet/v2-0136","code":"N","display":"No"}]}}},{"fullUrl":"Observation/4403633f-899d-3042-8a3e-863c27bd57ae","resource":{"resourceType":"Observation","id":"4403633f-899d-3042-8a3e-863c27bd57ae","identifier":[{"use":"official","type":{"coding":[{"system":"http://loinc.org","code":"81959-9","display":"Public health laboratory ask at order entry panel"}]}}],"status":"final","code":{"coding":[{"system":"http://loinc.org","code":"77974-4","display":"Hospitalized for condition"}],"text":"Hospitalized for condition"},"subject":{"reference":"Patient/1234"},"valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/ValueSet/v2-0136","code":"N","display":"No"}]}}},{"fullUrl":"Observation/b903826a-06bc-3c2d-a0e1-3b9aed860f0a","resource":{"resourceType":"Observation","id":"b903826a-06bc-3c2d-a0e1-3b9aed860f0a","identifier":[{"use":"official","type":{"coding":[{"system":"http://loinc.org","code":"81959-9","display":"Public health laboratory ask at order entry panel"}]}}],"status":"final","code":{"coding":[{"system":"http://loinc.org","code":"95420-6","display":"Admitted to ICU for condition"}],"text":"Admitted to ICU for condition"},"subject":{"reference":"Patient/1234"},"valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v3-NullFlavor","code":"UNK","display":"unknown"}]}}},{"fullUrl":"Observation/585761a1-2d41-3688-b5c7-9ae8535b4a67","resource":{"resourceType":"Observation","id":"585761a1-2d41-3688-b5c7-9ae8535b4a67","identifier":[{"use":"official","type":{"coding":[{"system":"http://loinc.org","code":"81959-9","display":"Public health laboratory ask at order entry panel"}]}}],"status":"final","code":{"coding":[{"system":"http://loinc.org","code":"95421-4","display":"Resides in a congregate care setting"}],"text":"Resides in a congregate care setting"},"subject":{"reference":"Patient/1234"},"valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/ValueSet/v2-0136","code":"Y","display":"Yes"}]}}},{"fullUrl":"Observation/870a2208-83f5-32a8-92e7-da4c228d7d6e","resource":{"resourceType":"Observation","id":"870a2208-83f5-32a8-92e7-da4c228d7d6e","identifier":[{"use":"official","type":{"coding":[{"system":"http://loinc.org","code":"81959-9","display":"Public health laboratory ask at order entry panel"}]}}],"status":"final","code":{"coding":[{"system":"http://loinc.org","code":"75617-1","display":"Residence"}],"text":"Residence"},"subject":{"reference":"Patient/1234"},"valueCodeableConcept":{"coding":[{"system":"http://snomed.info/sct","code":"30629002","display":"retirement home"}]}}}]} +{"resourceType":"Bundle","identifier":{"value":"234"},"type":"message","timestamp":"2023-05-24T19:33:06.472Z","entry":[{"fullUrl":"MessageHeader/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"MessageHeader","id":"5db534ea-5e97-4861-ba18-d74acc46db15","meta":{"tag":[{"system":"http://terminology.hl7.org/CodeSystem/v2-0103","code":"P","display":"Production"}]},"eventCoding":{"system":"http://terminology.hl7.org/CodeSystem/v2-0003","code":"R01","display":"ORU/ACK - Unsolicited transmission of an observation message"},"destination":[{"name":"PRIME ReportStream","endpoint":"https://prime.cdc.gov/api/reports?option=SkipInvalidItems"}],"sender":{"reference":"Organization/12345000-0000-0000-0000-000000000000"},"source":{"extension":[{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/software-binary-id","valueString":"short-commit-id"},{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/software-install-date","valueInstant":"2023-02-08T21:33:06Z"},{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/software-vendor-org","valueReference":{"reference":"Organization/07640c5d-87cd-488b-9343-a226c5166539"}}],"software":"PRIME SimpleReport","version":"short-commit-id","endpoint":"https://simplereport.gov"},"focus":[{"reference":"Provenance/5db534ea-5e97-4861-ba18-d74acc46db15"},{"reference":"DiagnosticReport/234"}]}},{"fullUrl":"Provenance/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"Provenance","id":"5db534ea-5e97-4861-ba18-d74acc46db15","recorded":"2023-05-24T19:33:06.472Z","activity":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v2-0003","code":"R01","display":"ORU/ACK - Unsolicited transmission of an observation message"}]},"agent":[{"who":{"reference":"Organization/12345000-0000-0000-0000-000000000000"}}]}},{"fullUrl":"DiagnosticReport/234","resource":{"resourceType":"DiagnosticReport","id":"234","identifier":[{"value":"234"}],"basedOn":[{"reference":"ServiceRequest/5db534ea-5e97-4861-ba18-d74acc46db15"}],"status":"final","code":{"coding":[{"system":"http://loinc.org","code":"94534-5"}]},"subject":{"reference":"Patient/2345"},"effectiveDateTime":"2021-12-23T14:00:00-06:00","issued":"2021-12-24T14:00:00-06:00","specimen":[{"reference":"Specimen/5db534ea-5e97-4861-ba18-d74acc46db15"}],"result":[{"reference":"Observation/5db534ea-5e97-4861-ba18-d74acc46db15"}]}},{"fullUrl":"Patient/2345","resource":{"resourceType":"Patient","id":"2345","extension":[{"url":"http://ibm.com/fhir/cdm/StructureDefinition/local-race-cd","valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v3-Race","code":"2106-3"}],"text":"White"}},{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/ethnic-group","valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v2-0189","code":"H","display":"Hispanic or Latino"}],"text":"Hispanic or Latino"}}],"identifier":[{"value":"2345"}],"name":[{"family":"Doe","given":["Jayne"]}],"telecom":[{"system":"phone","value":"(205) 999 2800","use":"mobile"}],"gender":"female","birthDate":"1962-01-20","address":[{"line":["123 Main St"],"city":"Birmingham","district":"Jefferson","state":"AL","postalCode":"35226","country":"USA"}],"managingOrganization":{"reference":"Organization/12345000-0000-0000-0000-000000000000"}}},{"fullUrl":"Organization/12345000-0000-0000-0000-000000000000","resource":{"resourceType":"Organization","id":"12345000-0000-0000-0000-000000000000","identifier":[{"use":"official","type":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v2-0301","code":"CLIA"}]},"value":"01D1058442"}],"name":"My Testing Lab","telecom":[{"system":"phone","value":"(205) 888 2000","use":"work"}],"address":[{"line":["300 North Street"],"city":"Birmingham","state":"AL","postalCode":"35228","country":"USA"}]}},{"fullUrl":"Organization/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"Organization","id":"5db534ea-5e97-4861-ba18-d74acc46db15","identifier":[{"use":"official","type":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v2-0301","code":"CLIA"}]},"value":"01D1058442"}],"name":"My Urgent Care","telecom":[{"system":"phone","value":"(205) 888 2000","use":"work"}],"address":[{"line":["400 Main Street","Suite 100"],"city":"Birmingham","state":"AL","postalCode":"35228","country":"USA"}]}},{"fullUrl":"Practitioner/1013012657","resource":{"resourceType":"Practitioner","id":"1013012657","identifier":[{"system":"http://hl7.org/fhir/sid/us-npi","value":"1013012657"}],"name":[{"family":"Smith MD","given":["John"]}],"telecom":[{"system":"phone","value":"(205) 888 2000","use":"work"}],"address":[{"line":["400 Main Street"],"city":"Birmingham","state":"AL","postalCode":"35228","country":"USA"}]}},{"fullUrl":"Specimen/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"Specimen","id":"5db534ea-5e97-4861-ba18-d74acc46db15","identifier":[{"value":"5db534ea-5e97-4861-ba18-d74acc46db15"}],"type":{"coding":[{"system":"http://snomed.info/sct","code":"445297001"}],"text":"Nasal swab"},"subject":{"reference":"Patient/2345"},"receivedTime":"2021-12-22T14:00:00-06:00","collection":{"collectedDateTime":"2021-12-21T14:00:00-06:00","bodySite":{"coding":[{"system":"http://snomed.info/sct","code":"53342003"}],"text":"Internal nose structure (body structure)"}}}},{"fullUrl":"ServiceRequest/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"ServiceRequest","id":"5db534ea-5e97-4861-ba18-d74acc46db15","extension":[{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/order-control","valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v2-0119","code":"RE"}]}},{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/order-effective-date","valueDateTime":"2021-12-20T14:00:00-06:00"}],"status":"completed","intent":"order","code":{"coding":[{"system":"http://loinc.org","code":"94534-5"}]},"subject":{"reference":"Patient/2345"},"requester":{"reference":"PractitionerRole/5db534ea-5e97-4861-ba18-d74acc46db15"},"performer":[{"reference":"Organization/12345000-0000-0000-0000-000000000000"}],"supportingInfo":[{"reference":"Observation/3dadfd89-ab2a-3f34-ab90-60180a5c7b9d"},{"reference":"Observation/07099f95-8754-3317-8e87-e1c4717c1af1"},{"reference":"Observation/7cae2c8e-cc60-35f6-8980-dd6bc9e1f539"},{"reference":"Observation/4403633f-899d-3042-8a3e-863c27bd57ae"},{"reference":"Observation/b903826a-06bc-3c2d-a0e1-3b9aed860f0a"},{"reference":"Observation/585761a1-2d41-3688-b5c7-9ae8535b4a67"},{"reference":"Observation/870a2208-83f5-32a8-92e7-da4c228d7d6e"}],"note":[{"extension":[{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/note-type","valueCodeableConcept":{"coding":[{"extension":[{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/code-index-name","valueString":"identifier"}],"system":"HL70364","version":"2.5.1","code":"RE","display":"Remark"}]}}],"text":"Test Comment 2"}]}},{"fullUrl":"Device/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"Device","id":"5db534ea-5e97-4861-ba18-d74acc46db15","identifier":[{"value":"543212134"},{"type":{"coding":[{"code":"MNI"}]}}],"manufacturer":"Acme","deviceName":[{"name":"ID NOW","type":"model-name"}]}},{"fullUrl":"PractitionerRole/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"PractitionerRole","id":"5db534ea-5e97-4861-ba18-d74acc46db15","practitioner":{"reference":"Practitioner/1013012657"},"organization":{"reference":"Organization/5db534ea-5e97-4861-ba18-d74acc46db15"}}},{"fullUrl":"Organization/07640c5d-87cd-488b-9343-a226c5166539","resource":{"resourceType":"Organization","id":"07640c5d-87cd-488b-9343-a226c5166539","name":"SimpleReport"}},{"fullUrl":"Observation/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"Observation","id":"5db534ea-5e97-4861-ba18-d74acc46db15","status":"final","code":{"coding":[{"system":"http://loinc.org","code":"94534-5"}],"text":"COVID-19"},"subject":{"reference":"Patient/2345"},"issued":"2021-12-23T20:00:00.000Z","performer":[{"reference":"Organization/12345000-0000-0000-0000-000000000000"}],"valueCodeableConcept":{"coding":[{"system":"http://snomed.info/sct","code":"260415000","display":"Not detected"}]},"interpretation":[{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v2-0078","code":"N","display":"Normal"}]}],"method":{"extension":[{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/testkit-name-id","valueCoding":{"code":"BOOMX2"}}],"coding":[{"display":"ID NOW"}]},"specimen":{"reference":"Specimen/5db534ea-5e97-4861-ba18-d74acc46db15"},"device":{"reference":"Device/5db534ea-5e97-4861-ba18-d74acc46db15"}}},{"fullUrl":"Observation/3dadfd89-ab2a-3f34-ab90-60180a5c7b9d","resource":{"resourceType":"Observation","id":"3dadfd89-ab2a-3f34-ab90-60180a5c7b9d","identifier":[{"use":"official","type":{"coding":[{"system":"http://loinc.org","code":"81959-9","display":"Public health laboratory ask at order entry panel"}]}}],"status":"final","code":{"coding":[{"system":"http://loinc.org","code":"95419-8","display":"Has symptoms related to condition of interest"}],"text":"Has symptoms related to condition of interest"},"subject":{"reference":"Patient/2345"},"valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/ValueSet/v2-0136","code":"N","display":"No"}]}}},{"fullUrl":"Observation/07099f95-8754-3317-8e87-e1c4717c1af1","resource":{"resourceType":"Observation","id":"07099f95-8754-3317-8e87-e1c4717c1af1","identifier":[{"use":"official","type":{"coding":[{"system":"http://loinc.org","code":"81959-9","display":"Public health laboratory ask at order entry panel"}]}}],"status":"final","code":{"coding":[{"system":"http://loinc.org","code":"82810-3","display":"Pregnancy status"}],"text":"Pregnancy status"},"subject":{"reference":"Patient/2345"},"valueCodeableConcept":{"coding":[{"system":"http://snomed.info/sct","code":"60001007","display":"Not pregnant"}]}}},{"fullUrl":"Observation/7cae2c8e-cc60-35f6-8980-dd6bc9e1f539","resource":{"resourceType":"Observation","id":"7cae2c8e-cc60-35f6-8980-dd6bc9e1f539","identifier":[{"use":"official","type":{"coding":[{"system":"http://loinc.org","code":"81959-9","display":"Public health laboratory ask at order entry panel"}]}}],"status":"final","code":{"coding":[{"system":"http://loinc.org","code":"95418-0","display":"Employed in a healthcare setting"}],"text":"Employed in a healthcare setting"},"subject":{"reference":"Patient/2345"},"valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/ValueSet/v2-0136","code":"Y","display":"Yes"}]}}},{"fullUrl":"Observation/4403633f-899d-3042-8a3e-863c27bd57ae","resource":{"resourceType":"Observation","id":"4403633f-899d-3042-8a3e-863c27bd57ae","identifier":[{"use":"official","type":{"coding":[{"system":"http://loinc.org","code":"81959-9","display":"Public health laboratory ask at order entry panel"}]}}],"status":"final","code":{"coding":[{"system":"http://loinc.org","code":"77974-4","display":"Hospitalized for condition"}],"text":"Hospitalized for condition"},"subject":{"reference":"Patient/2345"},"valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v3-NullFlavor","code":"UNK","display":"unknown"}]}}},{"fullUrl":"Observation/b903826a-06bc-3c2d-a0e1-3b9aed860f0a","resource":{"resourceType":"Observation","id":"b903826a-06bc-3c2d-a0e1-3b9aed860f0a","identifier":[{"use":"official","type":{"coding":[{"system":"http://loinc.org","code":"81959-9","display":"Public health laboratory ask at order entry panel"}]}}],"status":"final","code":{"coding":[{"system":"http://loinc.org","code":"95420-6","display":"Admitted to ICU for condition"}],"text":"Admitted to ICU for condition"},"subject":{"reference":"Patient/2345"},"valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/ValueSet/v2-0136","code":"N","display":"No"}]}}},{"fullUrl":"Observation/585761a1-2d41-3688-b5c7-9ae8535b4a67","resource":{"resourceType":"Observation","id":"585761a1-2d41-3688-b5c7-9ae8535b4a67","identifier":[{"use":"official","type":{"coding":[{"system":"http://loinc.org","code":"81959-9","display":"Public health laboratory ask at order entry panel"}]}}],"status":"final","code":{"coding":[{"system":"http://loinc.org","code":"95421-4","display":"Resides in a congregate care setting"}],"text":"Resides in a congregate care setting"},"subject":{"reference":"Patient/2345"},"valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/ValueSet/v2-0136","code":"Y","display":"Yes"}]}}},{"fullUrl":"Observation/870a2208-83f5-32a8-92e7-da4c228d7d6e","resource":{"resourceType":"Observation","id":"870a2208-83f5-32a8-92e7-da4c228d7d6e","identifier":[{"use":"official","type":{"coding":[{"system":"http://loinc.org","code":"81959-9","display":"Public health laboratory ask at order entry panel"}]}}],"status":"final","code":{"coding":[{"system":"http://loinc.org","code":"75617-1","display":"Residence"}],"text":"Residence"},"subject":{"reference":"Patient/2345"},"valueCodeableConcept":{"coding":[{"system":"http://snomed.info/sct","code":"224683003","display":"military accommodation"}]}}}]} +{"resourceType":"Bundle","identifier":{"value":"345"},"type":"message","timestamp":"2023-05-24T19:33:06.472Z","entry":[{"fullUrl":"MessageHeader/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"MessageHeader","id":"5db534ea-5e97-4861-ba18-d74acc46db15","meta":{"tag":[{"system":"http://terminology.hl7.org/CodeSystem/v2-0103","code":"P","display":"Production"}]},"eventCoding":{"system":"http://terminology.hl7.org/CodeSystem/v2-0003","code":"R01","display":"ORU/ACK - Unsolicited transmission of an observation message"},"destination":[{"name":"PRIME ReportStream","endpoint":"https://prime.cdc.gov/api/reports?option=SkipInvalidItems"}],"sender":{"reference":"Organization/12345000-0000-0000-0000-000000000000"},"source":{"extension":[{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/software-binary-id","valueString":"short-commit-id"},{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/software-install-date","valueInstant":"2023-02-08T21:33:06Z"},{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/software-vendor-org","valueReference":{"reference":"Organization/07640c5d-87cd-488b-9343-a226c5166539"}}],"software":"PRIME SimpleReport","version":"short-commit-id","endpoint":"https://simplereport.gov"},"focus":[{"reference":"Provenance/5db534ea-5e97-4861-ba18-d74acc46db15"},{"reference":"DiagnosticReport/345"}]}},{"fullUrl":"Provenance/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"Provenance","id":"5db534ea-5e97-4861-ba18-d74acc46db15","recorded":"2023-05-24T19:33:06.472Z","activity":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v2-0003","code":"R01","display":"ORU/ACK - Unsolicited transmission of an observation message"}]},"agent":[{"who":{"reference":"Organization/12345000-0000-0000-0000-000000000000"}}]}},{"fullUrl":"DiagnosticReport/345","resource":{"resourceType":"DiagnosticReport","id":"345","identifier":[{"value":"345"}],"basedOn":[{"reference":"ServiceRequest/5db534ea-5e97-4861-ba18-d74acc46db15"}],"status":"final","code":{"coding":[{"system":"http://loinc.org","code":"94534-5"}]},"subject":{"reference":"Patient/3456"},"effectiveDateTime":"2021-12-23T14:00:00-06:00","issued":"2021-12-24T14:00:00-06:00","specimen":[{"reference":"Specimen/5db534ea-5e97-4861-ba18-d74acc46db15"}],"result":[{"reference":"Observation/5db534ea-5e97-4861-ba18-d74acc46db15"}]}},{"fullUrl":"Patient/3456","resource":{"resourceType":"Patient","id":"3456","extension":[{"url":"http://ibm.com/fhir/cdm/StructureDefinition/local-race-cd","valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v3-Race","code":"2028-9"}],"text":"Asian"}},{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/ethnic-group","valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v2-0189","code":"N","display":"Not Hispanic or Latino"}],"text":"Not Hispanic or Latino"}}],"identifier":[{"value":"3456"}],"name":[{"family":"Doe","given":["Jan"]}],"telecom":[{"system":"phone","value":"(205) 999 2800","use":"mobile"}],"gender":"female","birthDate":"1962-01-20","address":[{"line":["123 Main St"],"city":"Birmingham","district":"Jefferson","state":"AL","postalCode":"35226","country":"USA"}],"managingOrganization":{"reference":"Organization/12345000-0000-0000-0000-000000000000"}}},{"fullUrl":"Organization/12345000-0000-0000-0000-000000000000","resource":{"resourceType":"Organization","id":"12345000-0000-0000-0000-000000000000","identifier":[{"use":"official","type":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v2-0301","code":"CLIA"}]},"value":"01D1058442"}],"name":"My Testing Lab","telecom":[{"system":"phone","value":"(205) 888 2000","use":"work"}],"address":[{"line":["300 North Street"],"city":"Birmingham","state":"AL","postalCode":"35228","country":"USA"}]}},{"fullUrl":"Organization/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"Organization","id":"5db534ea-5e97-4861-ba18-d74acc46db15","identifier":[{"use":"official","type":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v2-0301","code":"CLIA"}]},"value":"01D1058442"}],"name":"My Urgent Care","telecom":[{"system":"phone","value":"(205) 888 2000","use":"work"}],"address":[{"line":["400 Main Street","Suite 100"],"city":"Birmingham","state":"AL","postalCode":"35228","country":"USA"}]}},{"fullUrl":"Practitioner/1013012657","resource":{"resourceType":"Practitioner","id":"1013012657","identifier":[{"system":"http://hl7.org/fhir/sid/us-npi","value":"1013012657"}],"name":[{"family":"Smith MD","given":["John"]}],"telecom":[{"system":"phone","value":"(205) 888 2000","use":"work"}],"address":[{"line":["400 Main Street"],"city":"Birmingham","state":"AL","postalCode":"35228","country":"USA"}]}},{"fullUrl":"Specimen/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"Specimen","id":"5db534ea-5e97-4861-ba18-d74acc46db15","identifier":[{"value":"5db534ea-5e97-4861-ba18-d74acc46db15"}],"type":{"coding":[{"system":"http://snomed.info/sct","code":"445297001"}],"text":"Nasal swab"},"subject":{"reference":"Patient/3456"},"receivedTime":"2021-12-22T14:00:00-06:00","collection":{"collectedDateTime":"2021-12-21T14:00:00-06:00","bodySite":{"coding":[{"system":"http://snomed.info/sct","code":"53342003"}],"text":"Internal nose structure (body structure)"}}}},{"fullUrl":"ServiceRequest/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"ServiceRequest","id":"5db534ea-5e97-4861-ba18-d74acc46db15","extension":[{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/order-control","valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v2-0119","code":"RE"}]}},{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/order-effective-date","valueDateTime":"2021-12-20T14:00:00-06:00"}],"status":"completed","intent":"order","code":{"coding":[{"system":"http://loinc.org","code":"94534-5"}]},"subject":{"reference":"Patient/3456"},"requester":{"reference":"PractitionerRole/5db534ea-5e97-4861-ba18-d74acc46db15"},"performer":[{"reference":"Organization/12345000-0000-0000-0000-000000000000"}],"supportingInfo":[{"reference":"Observation/b24ef60b-fd2c-3987-9263-e27b7c5788ea"},{"reference":"Observation/07099f95-8754-3317-8e87-e1c4717c1af1"},{"reference":"Observation/7cae2c8e-cc60-35f6-8980-dd6bc9e1f539"},{"reference":"Observation/4403633f-899d-3042-8a3e-863c27bd57ae"},{"reference":"Observation/b903826a-06bc-3c2d-a0e1-3b9aed860f0a"},{"reference":"Observation/585761a1-2d41-3688-b5c7-9ae8535b4a67"}],"note":[{"extension":[{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/note-type","valueCodeableConcept":{"coding":[{"extension":[{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/code-index-name","valueString":"identifier"}],"system":"HL70364","version":"2.5.1","code":"RE","display":"Remark"}]}}],"text":"Test Comment 3"}]}},{"fullUrl":"Device/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"Device","id":"5db534ea-5e97-4861-ba18-d74acc46db15","identifier":[{"value":"543212134"},{"type":{"coding":[{"code":"MNI"}]}}],"manufacturer":"Acme","deviceName":[{"name":"ID NOW","type":"model-name"}]}},{"fullUrl":"PractitionerRole/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"PractitionerRole","id":"5db534ea-5e97-4861-ba18-d74acc46db15","practitioner":{"reference":"Practitioner/1013012657"},"organization":{"reference":"Organization/5db534ea-5e97-4861-ba18-d74acc46db15"}}},{"fullUrl":"Organization/07640c5d-87cd-488b-9343-a226c5166539","resource":{"resourceType":"Organization","id":"07640c5d-87cd-488b-9343-a226c5166539","name":"SimpleReport"}},{"fullUrl":"Observation/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"Observation","id":"5db534ea-5e97-4861-ba18-d74acc46db15","status":"final","code":{"coding":[{"system":"http://loinc.org","code":"94534-5"}],"text":"COVID-19"},"subject":{"reference":"Patient/3456"},"issued":"2021-12-23T20:00:00.000Z","performer":[{"reference":"Organization/12345000-0000-0000-0000-000000000000"}],"valueCodeableConcept":{"coding":[{"system":"http://snomed.info/sct","code":"260373001","display":"Detected"}]},"interpretation":[{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v2-0078","code":"A","display":"Abnormal"}]}],"method":{"extension":[{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/testkit-name-id","valueCoding":{"code":"BOOMX2"}}],"coding":[{"display":"ID NOW"}]},"specimen":{"reference":"Specimen/5db534ea-5e97-4861-ba18-d74acc46db15"},"device":{"reference":"Device/5db534ea-5e97-4861-ba18-d74acc46db15"}}},{"fullUrl":"Observation/b24ef60b-fd2c-3987-9263-e27b7c5788ea","resource":{"resourceType":"Observation","id":"b24ef60b-fd2c-3987-9263-e27b7c5788ea","identifier":[{"use":"official","type":{"coding":[{"system":"http://loinc.org","code":"81959-9","display":"Public health laboratory ask at order entry panel"}]}}],"status":"final","code":{"coding":[{"system":"http://loinc.org","code":"95419-8","display":"Has symptoms related to condition of interest"}],"text":"Has symptoms related to condition of interest"},"subject":{"reference":"Patient/3456"},"valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/ValueSet/v2-0136","code":"N","display":"No"}]}}},{"fullUrl":"Observation/07099f95-8754-3317-8e87-e1c4717c1af1","resource":{"resourceType":"Observation","id":"07099f95-8754-3317-8e87-e1c4717c1af1","identifier":[{"use":"official","type":{"coding":[{"system":"http://loinc.org","code":"81959-9","display":"Public health laboratory ask at order entry panel"}]}}],"status":"final","code":{"coding":[{"system":"http://loinc.org","code":"82810-3","display":"Pregnancy status"}],"text":"Pregnancy status"},"subject":{"reference":"Patient/3456"},"valueCodeableConcept":{"coding":[{"system":"http://snomed.info/sct","code":"60001007","display":"Not pregnant"}]}}},{"fullUrl":"Observation/7cae2c8e-cc60-35f6-8980-dd6bc9e1f539","resource":{"resourceType":"Observation","id":"7cae2c8e-cc60-35f6-8980-dd6bc9e1f539","identifier":[{"use":"official","type":{"coding":[{"system":"http://loinc.org","code":"81959-9","display":"Public health laboratory ask at order entry panel"}]}}],"status":"final","code":{"coding":[{"system":"http://loinc.org","code":"95418-0","display":"Employed in a healthcare setting"}],"text":"Employed in a healthcare setting"},"subject":{"reference":"Patient/3456"},"valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v3-NullFlavor","code":"UNK","display":"unknown"}]}}},{"fullUrl":"Observation/4403633f-899d-3042-8a3e-863c27bd57ae","resource":{"resourceType":"Observation","id":"4403633f-899d-3042-8a3e-863c27bd57ae","identifier":[{"use":"official","type":{"coding":[{"system":"http://loinc.org","code":"81959-9","display":"Public health laboratory ask at order entry panel"}]}}],"status":"final","code":{"coding":[{"system":"http://loinc.org","code":"77974-4","display":"Hospitalized for condition"}],"text":"Hospitalized for condition"},"subject":{"reference":"Patient/3456"},"valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/ValueSet/v2-0136","code":"N","display":"No"}]}}},{"fullUrl":"Observation/b903826a-06bc-3c2d-a0e1-3b9aed860f0a","resource":{"resourceType":"Observation","id":"b903826a-06bc-3c2d-a0e1-3b9aed860f0a","identifier":[{"use":"official","type":{"coding":[{"system":"http://loinc.org","code":"81959-9","display":"Public health laboratory ask at order entry panel"}]}}],"status":"final","code":{"coding":[{"system":"http://loinc.org","code":"95420-6","display":"Admitted to ICU for condition"}],"text":"Admitted to ICU for condition"},"subject":{"reference":"Patient/3456"},"valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/ValueSet/v2-0136","code":"Y","display":"Yes"}]}}},{"fullUrl":"Observation/585761a1-2d41-3688-b5c7-9ae8535b4a67","resource":{"resourceType":"Observation","id":"585761a1-2d41-3688-b5c7-9ae8535b4a67","identifier":[{"use":"official","type":{"coding":[{"system":"http://loinc.org","code":"81959-9","display":"Public health laboratory ask at order entry panel"}]}}],"status":"final","code":{"coding":[{"system":"http://loinc.org","code":"95421-4","display":"Resides in a congregate care setting"}],"text":"Resides in a congregate care setting"},"subject":{"reference":"Patient/3456"},"valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/ValueSet/v2-0136","code":"N","display":"No"}]}}}]} +{"resourceType":"Bundle","identifier":{"value":"456"},"type":"message","timestamp":"2023-05-24T19:33:06.472Z","entry":[{"fullUrl":"MessageHeader/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"MessageHeader","id":"5db534ea-5e97-4861-ba18-d74acc46db15","meta":{"tag":[{"system":"http://terminology.hl7.org/CodeSystem/v2-0103","code":"P","display":"Production"}]},"eventCoding":{"system":"http://terminology.hl7.org/CodeSystem/v2-0003","code":"R01","display":"ORU/ACK - Unsolicited transmission of an observation message"},"destination":[{"name":"PRIME ReportStream","endpoint":"https://prime.cdc.gov/api/reports?option=SkipInvalidItems"}],"sender":{"reference":"Organization/12345000-0000-0000-0000-000000000000"},"source":{"extension":[{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/software-binary-id","valueString":"short-commit-id"},{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/software-install-date","valueInstant":"2023-02-08T21:33:06Z"},{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/software-vendor-org","valueReference":{"reference":"Organization/07640c5d-87cd-488b-9343-a226c5166539"}}],"software":"PRIME SimpleReport","version":"short-commit-id","endpoint":"https://simplereport.gov"},"focus":[{"reference":"Provenance/5db534ea-5e97-4861-ba18-d74acc46db15"},{"reference":"DiagnosticReport/456"}]}},{"fullUrl":"Provenance/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"Provenance","id":"5db534ea-5e97-4861-ba18-d74acc46db15","recorded":"2023-05-24T19:33:06.472Z","activity":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v2-0003","code":"R01","display":"ORU/ACK - Unsolicited transmission of an observation message"}]},"agent":[{"who":{"reference":"Organization/12345000-0000-0000-0000-000000000000"}}]}},{"fullUrl":"DiagnosticReport/456","resource":{"resourceType":"DiagnosticReport","id":"456","identifier":[{"value":"456"}],"basedOn":[{"reference":"ServiceRequest/5db534ea-5e97-4861-ba18-d74acc46db15"}],"status":"final","code":{"coding":[{"system":"http://loinc.org","code":"94534-5"}]},"subject":{"reference":"Patient/4567"},"effectiveDateTime":"2021-12-23T14:00:00-06:00","issued":"2021-12-24T14:00:00-06:00","specimen":[{"reference":"Specimen/5db534ea-5e97-4861-ba18-d74acc46db15"}],"result":[{"reference":"Observation/5db534ea-5e97-4861-ba18-d74acc46db15"}]}},{"fullUrl":"Patient/4567","resource":{"resourceType":"Patient","id":"4567","extension":[{"url":"http://ibm.com/fhir/cdm/StructureDefinition/local-race-cd","valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v3-Race","code":"2054-5"}],"text":"Black or African American"}},{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/ethnic-group","valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v2-0189","code":"H","display":"Hispanic or Latino"}],"text":"Hispanic or Latino"}}],"identifier":[{"value":"4567"}],"name":[{"family":"Doe","given":["Jayn"]}],"telecom":[{"system":"phone","value":"(205) 999 2800","use":"mobile"}],"gender":"female","birthDate":"1962-01-20","address":[{"line":["123 Main St"],"city":"Birmingham","district":"Jefferson","state":"AL","postalCode":"35226","country":"USA"}],"managingOrganization":{"reference":"Organization/12345000-0000-0000-0000-000000000000"}}},{"fullUrl":"Organization/12345000-0000-0000-0000-000000000000","resource":{"resourceType":"Organization","id":"12345000-0000-0000-0000-000000000000","identifier":[{"use":"official","type":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v2-0301","code":"CLIA"}]},"value":"01D1058442"}],"name":"My Testing Lab","telecom":[{"system":"phone","value":"(205) 888 2000","use":"work"}],"address":[{"line":["300 North Street"],"city":"Birmingham","state":"AL","postalCode":"35228","country":"USA"}]}},{"fullUrl":"Organization/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"Organization","id":"5db534ea-5e97-4861-ba18-d74acc46db15","identifier":[{"use":"official","type":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v2-0301","code":"CLIA"}]},"value":"01D1058442"}],"name":"My Urgent Care","telecom":[{"system":"phone","value":"(205) 888 2000","use":"work"}],"address":[{"line":["400 Main Street","Suite 100"],"city":"Birmingham","state":"AL","postalCode":"35228","country":"USA"}]}},{"fullUrl":"Practitioner/1013012657","resource":{"resourceType":"Practitioner","id":"1013012657","identifier":[{"system":"http://hl7.org/fhir/sid/us-npi","value":"1013012657"}],"name":[{"family":"Smith MD","given":["John"]}],"telecom":[{"system":"phone","value":"(205) 888 2000","use":"work"}],"address":[{"line":["400 Main Street"],"city":"Birmingham","state":"AL","postalCode":"35228","country":"USA"}]}},{"fullUrl":"Specimen/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"Specimen","id":"5db534ea-5e97-4861-ba18-d74acc46db15","identifier":[{"value":"5db534ea-5e97-4861-ba18-d74acc46db15"}],"type":{"coding":[{"system":"http://snomed.info/sct","code":"445297001"}],"text":"Nasal swab"},"subject":{"reference":"Patient/4567"},"receivedTime":"2021-12-22T14:00:00-06:00","collection":{"collectedDateTime":"2021-12-21T14:00:00-06:00","bodySite":{"coding":[{"system":"http://snomed.info/sct","code":"53342003"}],"text":"Internal nose structure (body structure)"}}}},{"fullUrl":"ServiceRequest/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"ServiceRequest","id":"5db534ea-5e97-4861-ba18-d74acc46db15","extension":[{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/order-control","valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v2-0119","code":"RE"}]}},{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/order-effective-date","valueDateTime":"2021-12-20T14:00:00-06:00"}],"status":"completed","intent":"order","code":{"coding":[{"system":"http://loinc.org","code":"94534-5"}]},"subject":{"reference":"Patient/4567"},"requester":{"reference":"PractitionerRole/5db534ea-5e97-4861-ba18-d74acc46db15"},"performer":[{"reference":"Organization/12345000-0000-0000-0000-000000000000"}],"supportingInfo":[{"reference":"Observation/9456e7bb-dbe3-359f-abaa-e8c731fab37d"},{"reference":"Observation/f907292f-dde0-3d9d-a03c-f744f4d1e92a"},{"reference":"Observation/07099f95-8754-3317-8e87-e1c4717c1af1"},{"reference":"Observation/7cae2c8e-cc60-35f6-8980-dd6bc9e1f539"},{"reference":"Observation/4403633f-899d-3042-8a3e-863c27bd57ae"},{"reference":"Observation/b903826a-06bc-3c2d-a0e1-3b9aed860f0a"},{"reference":"Observation/585761a1-2d41-3688-b5c7-9ae8535b4a67"}],"note":[{"extension":[{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/note-type","valueCodeableConcept":{"coding":[{"extension":[{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/code-index-name","valueString":"identifier"}],"system":"HL70364","version":"2.5.1","code":"RE","display":"Remark"}]}}],"text":"Test Comment 4"}]}},{"fullUrl":"Device/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"Device","id":"5db534ea-5e97-4861-ba18-d74acc46db15","identifier":[{"value":"543212134"},{"type":{"coding":[{"code":"MNI"}]}}],"manufacturer":"Acme","deviceName":[{"name":"ID NOW","type":"model-name"}]}},{"fullUrl":"PractitionerRole/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"PractitionerRole","id":"5db534ea-5e97-4861-ba18-d74acc46db15","practitioner":{"reference":"Practitioner/1013012657"},"organization":{"reference":"Organization/5db534ea-5e97-4861-ba18-d74acc46db15"}}},{"fullUrl":"Organization/07640c5d-87cd-488b-9343-a226c5166539","resource":{"resourceType":"Organization","id":"07640c5d-87cd-488b-9343-a226c5166539","name":"SimpleReport"}},{"fullUrl":"Observation/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"Observation","id":"5db534ea-5e97-4861-ba18-d74acc46db15","status":"final","code":{"coding":[{"system":"http://loinc.org","code":"94534-5"}],"text":"COVID-19"},"subject":{"reference":"Patient/4567"},"issued":"2021-12-23T20:00:00.000Z","performer":[{"reference":"Organization/12345000-0000-0000-0000-000000000000"}],"valueCodeableConcept":{"coding":[{"system":"http://snomed.info/sct","code":"260415000","display":"Not detected"}]},"interpretation":[{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v2-0078","code":"N","display":"Normal"}]}],"method":{"extension":[{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/testkit-name-id","valueCoding":{"code":"BOOMX2"}}],"coding":[{"display":"ID NOW"}]},"specimen":{"reference":"Specimen/5db534ea-5e97-4861-ba18-d74acc46db15"},"device":{"reference":"Device/5db534ea-5e97-4861-ba18-d74acc46db15"}}},{"fullUrl":"Observation/9456e7bb-dbe3-359f-abaa-e8c731fab37d","resource":{"resourceType":"Observation","id":"9456e7bb-dbe3-359f-abaa-e8c731fab37d","identifier":[{"use":"official","type":{"coding":[{"system":"http://loinc.org","code":"81959-9","display":"Public health laboratory ask at order entry panel"}]}}],"status":"final","code":{"coding":[{"system":"http://loinc.org","code":"95419-8","display":"Has symptoms related to condition of interest"}],"text":"Has symptoms related to condition of interest"},"subject":{"reference":"Patient/4567"},"valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/ValueSet/v2-0136","code":"Y","display":"Yes"}]}}},{"fullUrl":"Observation/f907292f-dde0-3d9d-a03c-f744f4d1e92a","resource":{"resourceType":"Observation","id":"f907292f-dde0-3d9d-a03c-f744f4d1e92a","identifier":[{"use":"official","type":{"coding":[{"system":"http://loinc.org","code":"81959-9","display":"Public health laboratory ask at order entry panel"}]}}],"status":"final","code":{"coding":[{"system":"http://loinc.org","code":"11368-8","display":"Illness or injury onset date and time"}],"text":"Illness or injury onset date and time"},"subject":{"reference":"Patient/4567"},"valueDateTime":"2020-01-01"}},{"fullUrl":"Observation/07099f95-8754-3317-8e87-e1c4717c1af1","resource":{"resourceType":"Observation","id":"07099f95-8754-3317-8e87-e1c4717c1af1","identifier":[{"use":"official","type":{"coding":[{"system":"http://loinc.org","code":"81959-9","display":"Public health laboratory ask at order entry panel"}]}}],"status":"final","code":{"coding":[{"system":"http://loinc.org","code":"82810-3","display":"Pregnancy status"}],"text":"Pregnancy status"},"subject":{"reference":"Patient/4567"},"valueCodeableConcept":{"coding":[{"system":"http://snomed.info/sct","code":"60001007","display":"Not pregnant"}]}}},{"fullUrl":"Observation/7cae2c8e-cc60-35f6-8980-dd6bc9e1f539","resource":{"resourceType":"Observation","id":"7cae2c8e-cc60-35f6-8980-dd6bc9e1f539","identifier":[{"use":"official","type":{"coding":[{"system":"http://loinc.org","code":"81959-9","display":"Public health laboratory ask at order entry panel"}]}}],"status":"final","code":{"coding":[{"system":"http://loinc.org","code":"95418-0","display":"Employed in a healthcare setting"}],"text":"Employed in a healthcare setting"},"subject":{"reference":"Patient/4567"},"valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/ValueSet/v2-0136","code":"N","display":"No"}]}}},{"fullUrl":"Observation/4403633f-899d-3042-8a3e-863c27bd57ae","resource":{"resourceType":"Observation","id":"4403633f-899d-3042-8a3e-863c27bd57ae","identifier":[{"use":"official","type":{"coding":[{"system":"http://loinc.org","code":"81959-9","display":"Public health laboratory ask at order entry panel"}]}}],"status":"final","code":{"coding":[{"system":"http://loinc.org","code":"77974-4","display":"Hospitalized for condition"}],"text":"Hospitalized for condition"},"subject":{"reference":"Patient/4567"},"valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/ValueSet/v2-0136","code":"N","display":"No"}]}}},{"fullUrl":"Observation/b903826a-06bc-3c2d-a0e1-3b9aed860f0a","resource":{"resourceType":"Observation","id":"b903826a-06bc-3c2d-a0e1-3b9aed860f0a","identifier":[{"use":"official","type":{"coding":[{"system":"http://loinc.org","code":"81959-9","display":"Public health laboratory ask at order entry panel"}]}}],"status":"final","code":{"coding":[{"system":"http://loinc.org","code":"95420-6","display":"Admitted to ICU for condition"}],"text":"Admitted to ICU for condition"},"subject":{"reference":"Patient/4567"},"valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/ValueSet/v2-0136","code":"N","display":"No"}]}}},{"fullUrl":"Observation/585761a1-2d41-3688-b5c7-9ae8535b4a67","resource":{"resourceType":"Observation","id":"585761a1-2d41-3688-b5c7-9ae8535b4a67","identifier":[{"use":"official","type":{"coding":[{"system":"http://loinc.org","code":"81959-9","display":"Public health laboratory ask at order entry panel"}]}}],"status":"final","code":{"coding":[{"system":"http://loinc.org","code":"95421-4","display":"Resides in a congregate care setting"}],"text":"Resides in a congregate care setting"},"subject":{"reference":"Patient/4567"},"valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/ValueSet/v2-0136","code":"N","display":"No"}]}}}]} +{"resourceType":"Bundle","identifier":{"value":"567"},"type":"message","timestamp":"2023-05-24T19:33:06.472Z","entry":[{"fullUrl":"MessageHeader/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"MessageHeader","id":"5db534ea-5e97-4861-ba18-d74acc46db15","meta":{"tag":[{"system":"http://terminology.hl7.org/CodeSystem/v2-0103","code":"P","display":"Production"}]},"eventCoding":{"system":"http://terminology.hl7.org/CodeSystem/v2-0003","code":"R01","display":"ORU/ACK - Unsolicited transmission of an observation message"},"destination":[{"name":"PRIME ReportStream","endpoint":"https://prime.cdc.gov/api/reports?option=SkipInvalidItems"}],"sender":{"reference":"Organization/12345000-0000-0000-0000-000000000000"},"source":{"extension":[{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/software-binary-id","valueString":"short-commit-id"},{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/software-install-date","valueInstant":"2023-02-08T21:33:06Z"},{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/software-vendor-org","valueReference":{"reference":"Organization/07640c5d-87cd-488b-9343-a226c5166539"}}],"software":"PRIME SimpleReport","version":"short-commit-id","endpoint":"https://simplereport.gov"},"focus":[{"reference":"Provenance/5db534ea-5e97-4861-ba18-d74acc46db15"},{"reference":"DiagnosticReport/567"}]}},{"fullUrl":"Provenance/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"Provenance","id":"5db534ea-5e97-4861-ba18-d74acc46db15","recorded":"2023-05-24T19:33:06.472Z","activity":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v2-0003","code":"R01","display":"ORU/ACK - Unsolicited transmission of an observation message"}]},"agent":[{"who":{"reference":"Organization/12345000-0000-0000-0000-000000000000"}}]}},{"fullUrl":"DiagnosticReport/567","resource":{"resourceType":"DiagnosticReport","id":"567","identifier":[{"value":"567"}],"basedOn":[{"reference":"ServiceRequest/5db534ea-5e97-4861-ba18-d74acc46db15"}],"status":"final","code":{"coding":[{"system":"http://loinc.org","code":"94534-5"}]},"subject":{"reference":"Patient/4567"},"effectiveDateTime":"2021-12-23T14:00:00-06:00","issued":"2021-12-24T14:00:00-06:00","specimen":[{"reference":"Specimen/5db534ea-5e97-4861-ba18-d74acc46db15"}],"result":[{"reference":"Observation/5db534ea-5e97-4861-ba18-d74acc46db15"}]}},{"fullUrl":"Patient/4567","resource":{"resourceType":"Patient","id":"4567","extension":[{"url":"http://ibm.com/fhir/cdm/StructureDefinition/local-race-cd","valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v3-NullFlavor","code":"UNK"}],"text":"Unknown"}},{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/ethnic-group","valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v2-0189","code":"U","display":"unknown"}],"text":"unknown"}}],"identifier":[{"value":"4567"}],"name":[{"family":"Doe","given":["Janey"]}],"telecom":[{"system":"phone","value":"(205) 999 2800","use":"mobile"}],"gender":"female","birthDate":"1962-01-20","address":[{"line":["123 Main St"],"city":"Birmingham","district":"Jefferson","state":"AL","postalCode":"35226","country":"USA"}],"managingOrganization":{"reference":"Organization/12345000-0000-0000-0000-000000000000"}}},{"fullUrl":"Organization/12345000-0000-0000-0000-000000000000","resource":{"resourceType":"Organization","id":"12345000-0000-0000-0000-000000000000","identifier":[{"use":"official","type":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v2-0301","code":"CLIA"}]},"value":"01D1058442"}],"name":"My Testing Lab","telecom":[{"system":"phone","value":"(205) 888 2000","use":"work"}],"address":[{"line":["300 North Street"],"city":"Birmingham","state":"AL","postalCode":"35228","country":"USA"}]}},{"fullUrl":"Organization/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"Organization","id":"5db534ea-5e97-4861-ba18-d74acc46db15","identifier":[{"use":"official","type":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v2-0301","code":"CLIA"}]},"value":"01D1058442"}],"name":"My Urgent Care","telecom":[{"system":"phone","value":"(205) 888 2000","use":"work"}],"address":[{"line":["400 Main Street","Suite 100"],"city":"Birmingham","state":"AL","postalCode":"35228","country":"USA"}]}},{"fullUrl":"Practitioner/1013012657","resource":{"resourceType":"Practitioner","id":"1013012657","identifier":[{"system":"http://hl7.org/fhir/sid/us-npi","value":"1013012657"}],"name":[{"family":"Smith MD","given":["John"]}],"telecom":[{"system":"phone","value":"(205) 888 2000","use":"work"}],"address":[{"line":["400 Main Street"],"city":"Birmingham","state":"AL","postalCode":"35228","country":"USA"}]}},{"fullUrl":"Specimen/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"Specimen","id":"5db534ea-5e97-4861-ba18-d74acc46db15","identifier":[{"value":"5db534ea-5e97-4861-ba18-d74acc46db15"}],"type":{"coding":[{"system":"http://snomed.info/sct","code":"445297001"}],"text":"Nasal swab"},"subject":{"reference":"Patient/4567"},"receivedTime":"2021-12-22T14:00:00-06:00","collection":{"collectedDateTime":"2021-12-21T14:00:00-06:00","bodySite":{"coding":[{"system":"http://snomed.info/sct","code":"53342003"}],"text":"Internal nose structure (body structure)"}}}},{"fullUrl":"ServiceRequest/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"ServiceRequest","id":"5db534ea-5e97-4861-ba18-d74acc46db15","extension":[{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/order-control","valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v2-0119","code":"RE"}]}},{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/order-effective-date","valueDateTime":"2021-12-20T14:00:00-06:00"}],"status":"completed","intent":"order","code":{"coding":[{"system":"http://loinc.org","code":"94534-5"}]},"subject":{"reference":"Patient/4567"},"requester":{"reference":"PractitionerRole/5db534ea-5e97-4861-ba18-d74acc46db15"},"performer":[{"reference":"Organization/12345000-0000-0000-0000-000000000000"}],"supportingInfo":[{"reference":"Observation/b1e252e3-6d94-3123-91f5-2df61a166812"},{"reference":"Observation/07099f95-8754-3317-8e87-e1c4717c1af1"},{"reference":"Observation/7cae2c8e-cc60-35f6-8980-dd6bc9e1f539"},{"reference":"Observation/4403633f-899d-3042-8a3e-863c27bd57ae"},{"reference":"Observation/b903826a-06bc-3c2d-a0e1-3b9aed860f0a"},{"reference":"Observation/585761a1-2d41-3688-b5c7-9ae8535b4a67"}],"note":[{"extension":[{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/note-type","valueCodeableConcept":{"coding":[{"extension":[{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/code-index-name","valueString":"identifier"}],"system":"HL70364","version":"2.5.1","code":"RE","display":"Remark"}]}}],"text":"Test Comment 5"}]}},{"fullUrl":"Device/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"Device","id":"5db534ea-5e97-4861-ba18-d74acc46db15","identifier":[{"value":"543212134"},{"type":{"coding":[{"code":"MNI"}]}}],"manufacturer":"Acme","deviceName":[{"name":"ID NOW","type":"model-name"}]}},{"fullUrl":"PractitionerRole/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"PractitionerRole","id":"5db534ea-5e97-4861-ba18-d74acc46db15","practitioner":{"reference":"Practitioner/1013012657"},"organization":{"reference":"Organization/5db534ea-5e97-4861-ba18-d74acc46db15"}}},{"fullUrl":"Organization/07640c5d-87cd-488b-9343-a226c5166539","resource":{"resourceType":"Organization","id":"07640c5d-87cd-488b-9343-a226c5166539","name":"SimpleReport"}},{"fullUrl":"Observation/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"Observation","id":"5db534ea-5e97-4861-ba18-d74acc46db15","status":"final","code":{"coding":[{"system":"http://loinc.org","code":"94534-5"}],"text":"COVID-19"},"subject":{"reference":"Patient/4567"},"issued":"2021-12-23T20:00:00.000Z","performer":[{"reference":"Organization/12345000-0000-0000-0000-000000000000"}],"valueCodeableConcept":{"coding":[{"system":"http://snomed.info/sct","code":"455371000124106","display":"Invalid result"}]},"interpretation":[{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v2-0078","code":"N","display":"Normal"}]}],"method":{"extension":[{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/testkit-name-id","valueCoding":{"code":"BOOMX2"}}],"coding":[{"display":"ID NOW"}]},"specimen":{"reference":"Specimen/5db534ea-5e97-4861-ba18-d74acc46db15"},"device":{"reference":"Device/5db534ea-5e97-4861-ba18-d74acc46db15"}}},{"fullUrl":"Observation/b1e252e3-6d94-3123-91f5-2df61a166812","resource":{"resourceType":"Observation","id":"b1e252e3-6d94-3123-91f5-2df61a166812","identifier":[{"use":"official","type":{"coding":[{"system":"http://loinc.org","code":"81959-9","display":"Public health laboratory ask at order entry panel"}]}}],"status":"final","code":{"coding":[{"system":"http://loinc.org","code":"95419-8","display":"Has symptoms related to condition of interest"}],"text":"Has symptoms related to condition of interest"},"subject":{"reference":"Patient/4567"},"valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/ValueSet/v2-0136","code":"N","display":"No"}]}}},{"fullUrl":"Observation/07099f95-8754-3317-8e87-e1c4717c1af1","resource":{"resourceType":"Observation","id":"07099f95-8754-3317-8e87-e1c4717c1af1","identifier":[{"use":"official","type":{"coding":[{"system":"http://loinc.org","code":"81959-9","display":"Public health laboratory ask at order entry panel"}]}}],"status":"final","code":{"coding":[{"system":"http://loinc.org","code":"82810-3","display":"Pregnancy status"}],"text":"Pregnancy status"},"subject":{"reference":"Patient/4567"},"valueCodeableConcept":{"coding":[{"system":"http://snomed.info/sct","code":"102874004","display":"Unknown"}]}}},{"fullUrl":"Observation/7cae2c8e-cc60-35f6-8980-dd6bc9e1f539","resource":{"resourceType":"Observation","id":"7cae2c8e-cc60-35f6-8980-dd6bc9e1f539","identifier":[{"use":"official","type":{"coding":[{"system":"http://loinc.org","code":"81959-9","display":"Public health laboratory ask at order entry panel"}]}}],"status":"final","code":{"coding":[{"system":"http://loinc.org","code":"95418-0","display":"Employed in a healthcare setting"}],"text":"Employed in a healthcare setting"},"subject":{"reference":"Patient/4567"},"valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/ValueSet/v2-0136","code":"N","display":"No"}]}}},{"fullUrl":"Observation/4403633f-899d-3042-8a3e-863c27bd57ae","resource":{"resourceType":"Observation","id":"4403633f-899d-3042-8a3e-863c27bd57ae","identifier":[{"use":"official","type":{"coding":[{"system":"http://loinc.org","code":"81959-9","display":"Public health laboratory ask at order entry panel"}]}}],"status":"final","code":{"coding":[{"system":"http://loinc.org","code":"77974-4","display":"Hospitalized for condition"}],"text":"Hospitalized for condition"},"subject":{"reference":"Patient/4567"},"valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/ValueSet/v2-0136","code":"Y","display":"Yes"}]}}},{"fullUrl":"Observation/b903826a-06bc-3c2d-a0e1-3b9aed860f0a","resource":{"resourceType":"Observation","id":"b903826a-06bc-3c2d-a0e1-3b9aed860f0a","identifier":[{"use":"official","type":{"coding":[{"system":"http://loinc.org","code":"81959-9","display":"Public health laboratory ask at order entry panel"}]}}],"status":"final","code":{"coding":[{"system":"http://loinc.org","code":"95420-6","display":"Admitted to ICU for condition"}],"text":"Admitted to ICU for condition"},"subject":{"reference":"Patient/4567"},"valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/ValueSet/v2-0136","code":"N","display":"No"}]}}},{"fullUrl":"Observation/585761a1-2d41-3688-b5c7-9ae8535b4a67","resource":{"resourceType":"Observation","id":"585761a1-2d41-3688-b5c7-9ae8535b4a67","identifier":[{"use":"official","type":{"coding":[{"system":"http://loinc.org","code":"81959-9","display":"Public health laboratory ask at order entry panel"}]}}],"status":"final","code":{"coding":[{"system":"http://loinc.org","code":"95421-4","display":"Resides in a congregate care setting"}],"text":"Resides in a congregate care setting"},"subject":{"reference":"Patient/4567"},"valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v3-NullFlavor","code":"UNK","display":"unknown"}]}}}]} +{"resourceType":"Bundle","identifier":{"value":"678"},"type":"message","timestamp":"2023-05-24T19:33:06.472Z","entry":[{"fullUrl":"MessageHeader/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"MessageHeader","id":"5db534ea-5e97-4861-ba18-d74acc46db15","meta":{"tag":[{"system":"http://terminology.hl7.org/CodeSystem/v2-0103","code":"P","display":"Production"}]},"eventCoding":{"system":"http://terminology.hl7.org/CodeSystem/v2-0003","code":"R01","display":"ORU/ACK - Unsolicited transmission of an observation message"},"destination":[{"name":"PRIME ReportStream","endpoint":"https://prime.cdc.gov/api/reports?option=SkipInvalidItems"}],"sender":{"reference":"Organization/12345000-0000-0000-0000-000000000000"},"source":{"extension":[{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/software-binary-id","valueString":"short-commit-id"},{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/software-install-date","valueInstant":"2023-02-08T21:33:06Z"},{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/software-vendor-org","valueReference":{"reference":"Organization/07640c5d-87cd-488b-9343-a226c5166539"}}],"software":"PRIME SimpleReport","version":"short-commit-id","endpoint":"https://simplereport.gov"},"focus":[{"reference":"Provenance/5db534ea-5e97-4861-ba18-d74acc46db15"},{"reference":"DiagnosticReport/678"}]}},{"fullUrl":"Provenance/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"Provenance","id":"5db534ea-5e97-4861-ba18-d74acc46db15","recorded":"2023-05-24T19:33:06.472Z","activity":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v2-0003","code":"R01","display":"ORU/ACK - Unsolicited transmission of an observation message"}]},"agent":[{"who":{"reference":"Organization/12345000-0000-0000-0000-000000000000"}}]}},{"fullUrl":"DiagnosticReport/678","resource":{"resourceType":"DiagnosticReport","id":"678","identifier":[{"value":"678"}],"basedOn":[{"reference":"ServiceRequest/5db534ea-5e97-4861-ba18-d74acc46db15"}],"status":"final","code":{"coding":[{"system":"http://loinc.org","code":"94534-5"}]},"subject":{"reference":"Patient/4567"},"effectiveDateTime":"2021-12-23T14:00:00-06:00","issued":"2021-12-24T14:00:00-06:00","specimen":[{"reference":"Specimen/5db534ea-5e97-4861-ba18-d74acc46db15"}],"result":[{"reference":"Observation/5db534ea-5e97-4861-ba18-d74acc46db15"}]}},{"fullUrl":"Patient/4567","resource":{"resourceType":"Patient","id":"4567","extension":[{"url":"http://ibm.com/fhir/cdm/StructureDefinition/local-race-cd","valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v3-Race","code":"2131-1"}],"text":"other"}},{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/ethnic-group","valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v2-0189","code":"N","display":"Not Hispanic or Latino"}],"text":"Not Hispanic or Latino"}}],"identifier":[{"value":"4567"}],"name":[{"family":"Doe","given":["Janey"]}],"telecom":[{"system":"phone","value":"(205) 999 2800","use":"mobile"}],"gender":"female","birthDate":"1962-01-20","address":[{"line":["123 Main St"],"city":"Birmingham","district":"Jefferson","state":"AL","postalCode":"35226","country":"USA"}],"managingOrganization":{"reference":"Organization/12345000-0000-0000-0000-000000000000"}}},{"fullUrl":"Organization/12345000-0000-0000-0000-000000000000","resource":{"resourceType":"Organization","id":"12345000-0000-0000-0000-000000000000","identifier":[{"use":"official","type":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v2-0301","code":"CLIA"}]},"value":"01D1058442"}],"name":"My Testing Lab","telecom":[{"system":"phone","value":"(205) 888 2000","use":"work"}],"address":[{"line":["300 North Street"],"city":"Birmingham","state":"AL","postalCode":"35228","country":"USA"}]}},{"fullUrl":"Organization/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"Organization","id":"5db534ea-5e97-4861-ba18-d74acc46db15","identifier":[{"use":"official","type":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v2-0301","code":"CLIA"}]},"value":"01D1058442"}],"name":"My Urgent Care","telecom":[{"system":"phone","value":"(205) 888 2000","use":"work"}],"address":[{"line":["400 Main Street","Suite 100"],"city":"Birmingham","state":"AL","postalCode":"35228","country":"USA"}]}},{"fullUrl":"Practitioner/1013012657","resource":{"resourceType":"Practitioner","id":"1013012657","identifier":[{"system":"http://hl7.org/fhir/sid/us-npi","value":"1013012657"}],"name":[{"family":"Smith MD","given":["John"]}],"telecom":[{"system":"phone","value":"(205) 888 2000","use":"work"}],"address":[{"line":["400 Main Street"],"city":"Birmingham","state":"AL","postalCode":"35228","country":"USA"}]}},{"fullUrl":"Specimen/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"Specimen","id":"5db534ea-5e97-4861-ba18-d74acc46db15","identifier":[{"value":"5db534ea-5e97-4861-ba18-d74acc46db15"}],"type":{"coding":[{"system":"http://snomed.info/sct","code":"445297001"}],"text":"Nasal swab"},"subject":{"reference":"Patient/4567"},"receivedTime":"2021-12-22T14:00:00-06:00","collection":{"collectedDateTime":"2021-12-21T14:00:00-06:00","bodySite":{"coding":[{"system":"http://snomed.info/sct","code":"53342003"}],"text":"Internal nose structure (body structure)"}}}},{"fullUrl":"ServiceRequest/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"ServiceRequest","id":"5db534ea-5e97-4861-ba18-d74acc46db15","extension":[{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/order-control","valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v2-0119","code":"RE"}]}},{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/order-effective-date","valueDateTime":"2021-12-20T14:00:00-06:00"}],"status":"completed","intent":"order","code":{"coding":[{"system":"http://loinc.org","code":"94534-5"}]},"subject":{"reference":"Patient/4567"},"requester":{"reference":"PractitionerRole/5db534ea-5e97-4861-ba18-d74acc46db15"},"performer":[{"reference":"Organization/12345000-0000-0000-0000-000000000000"}],"supportingInfo":[{"reference":"Observation/a65bbde7-854d-3151-b46b-731badba996b"},{"reference":"Observation/07099f95-8754-3317-8e87-e1c4717c1af1"},{"reference":"Observation/7cae2c8e-cc60-35f6-8980-dd6bc9e1f539"},{"reference":"Observation/4403633f-899d-3042-8a3e-863c27bd57ae"},{"reference":"Observation/b903826a-06bc-3c2d-a0e1-3b9aed860f0a"},{"reference":"Observation/585761a1-2d41-3688-b5c7-9ae8535b4a67"}],"note":[{"extension":[{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/note-type","valueCodeableConcept":{"coding":[{"extension":[{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/code-index-name","valueString":"identifier"}],"system":"HL70364","version":"2.5.1","code":"RE","display":"Remark"}]}}],"text":"Test Comment 6"}]}},{"fullUrl":"Device/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"Device","id":"5db534ea-5e97-4861-ba18-d74acc46db15","identifier":[{"value":"543212134"},{"type":{"coding":[{"code":"MNI"}]}}],"manufacturer":"Acme","deviceName":[{"name":"ID NOW","type":"model-name"}]}},{"fullUrl":"PractitionerRole/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"PractitionerRole","id":"5db534ea-5e97-4861-ba18-d74acc46db15","practitioner":{"reference":"Practitioner/1013012657"},"organization":{"reference":"Organization/5db534ea-5e97-4861-ba18-d74acc46db15"}}},{"fullUrl":"Organization/07640c5d-87cd-488b-9343-a226c5166539","resource":{"resourceType":"Organization","id":"07640c5d-87cd-488b-9343-a226c5166539","name":"SimpleReport"}},{"fullUrl":"Observation/5db534ea-5e97-4861-ba18-d74acc46db15","resource":{"resourceType":"Observation","id":"5db534ea-5e97-4861-ba18-d74acc46db15","status":"final","code":{"coding":[{"system":"http://loinc.org","code":"94534-5"}],"text":"COVID-19"},"subject":{"reference":"Patient/4567"},"issued":"2021-12-23T20:00:00.000Z","performer":[{"reference":"Organization/12345000-0000-0000-0000-000000000000"}],"valueCodeableConcept":{"coding":[{"system":"http://snomed.info/sct","code":"260373001","display":"Detected"}]},"interpretation":[{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v2-0078","code":"A","display":"Abnormal"}]}],"method":{"extension":[{"url":"https://reportstream.cdc.gov/fhir/StructureDefinition/testkit-name-id","valueCoding":{"code":"BOOMX2"}}],"coding":[{"display":"ID NOW"}]},"specimen":{"reference":"Specimen/5db534ea-5e97-4861-ba18-d74acc46db15"},"device":{"reference":"Device/5db534ea-5e97-4861-ba18-d74acc46db15"}}},{"fullUrl":"Observation/a65bbde7-854d-3151-b46b-731badba996b","resource":{"resourceType":"Observation","id":"a65bbde7-854d-3151-b46b-731badba996b","identifier":[{"use":"official","type":{"coding":[{"system":"http://loinc.org","code":"81959-9","display":"Public health laboratory ask at order entry panel"}]}}],"status":"final","code":{"coding":[{"system":"http://loinc.org","code":"95419-8","display":"Has symptoms related to condition of interest"}],"text":"Has symptoms related to condition of interest"},"subject":{"reference":"Patient/4567"},"valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v3-NullFlavor","code":"UNK","display":"unknown"}]}}},{"fullUrl":"Observation/07099f95-8754-3317-8e87-e1c4717c1af1","resource":{"resourceType":"Observation","id":"07099f95-8754-3317-8e87-e1c4717c1af1","identifier":[{"use":"official","type":{"coding":[{"system":"http://loinc.org","code":"81959-9","display":"Public health laboratory ask at order entry panel"}]}}],"status":"final","code":{"coding":[{"system":"http://loinc.org","code":"82810-3","display":"Pregnancy status"}],"text":"Pregnancy status"},"subject":{"reference":"Patient/4567"},"valueCodeableConcept":{"coding":[{"system":"http://snomed.info/sct","code":"60001007","display":"Not pregnant"}]}}},{"fullUrl":"Observation/7cae2c8e-cc60-35f6-8980-dd6bc9e1f539","resource":{"resourceType":"Observation","id":"7cae2c8e-cc60-35f6-8980-dd6bc9e1f539","identifier":[{"use":"official","type":{"coding":[{"system":"http://loinc.org","code":"81959-9","display":"Public health laboratory ask at order entry panel"}]}}],"status":"final","code":{"coding":[{"system":"http://loinc.org","code":"95418-0","display":"Employed in a healthcare setting"}],"text":"Employed in a healthcare setting"},"subject":{"reference":"Patient/4567"},"valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/ValueSet/v2-0136","code":"N","display":"No"}]}}},{"fullUrl":"Observation/4403633f-899d-3042-8a3e-863c27bd57ae","resource":{"resourceType":"Observation","id":"4403633f-899d-3042-8a3e-863c27bd57ae","identifier":[{"use":"official","type":{"coding":[{"system":"http://loinc.org","code":"81959-9","display":"Public health laboratory ask at order entry panel"}]}}],"status":"final","code":{"coding":[{"system":"http://loinc.org","code":"77974-4","display":"Hospitalized for condition"}],"text":"Hospitalized for condition"},"subject":{"reference":"Patient/4567"},"valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/ValueSet/v2-0136","code":"N","display":"No"}]}}},{"fullUrl":"Observation/b903826a-06bc-3c2d-a0e1-3b9aed860f0a","resource":{"resourceType":"Observation","id":"b903826a-06bc-3c2d-a0e1-3b9aed860f0a","identifier":[{"use":"official","type":{"coding":[{"system":"http://loinc.org","code":"81959-9","display":"Public health laboratory ask at order entry panel"}]}}],"status":"final","code":{"coding":[{"system":"http://loinc.org","code":"95420-6","display":"Admitted to ICU for condition"}],"text":"Admitted to ICU for condition"},"subject":{"reference":"Patient/4567"},"valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/ValueSet/v2-0136","code":"N","display":"No"}]}}},{"fullUrl":"Observation/585761a1-2d41-3688-b5c7-9ae8535b4a67","resource":{"resourceType":"Observation","id":"585761a1-2d41-3688-b5c7-9ae8535b4a67","identifier":[{"use":"official","type":{"coding":[{"system":"http://loinc.org","code":"81959-9","display":"Public health laboratory ask at order entry panel"}]}}],"status":"final","code":{"coding":[{"system":"http://loinc.org","code":"95421-4","display":"Resides in a congregate care setting"}],"text":"Resides in a congregate care setting"},"subject":{"reference":"Patient/4567"},"valueCodeableConcept":{"coding":[{"system":"http://terminology.hl7.org/ValueSet/v2-0136","code":"N","display":"No"}]}}}]} \ No newline at end of file