def testTextLocationAnnotationRequest(self):
     """Test TextLocationAnnotationRequest"""
     TextLocationAnnotationRequest(
         note=Note(identifier=NoteId("identifier"),
                   text="text",
                   type="type",
                   patient_id=PatientId('patient-1')))
예제 #2
0
 def testNote(self):
     """Test Note"""
     # FIXME: construct object with mandatory attributes with example values
     # model = Note()  # noqa: E501
     Note(identifier=NoteId("identifier"),
          text="text",
          type="type",
          patient_id=PatientId('patient-1'))
예제 #3
0
def client_note_to_request_dict(note: Note):
    """Take a (datanode) Note model object, return a JSON dict (with camelCase
    keys).
    """
    snake_note_dict = note.to_dict()
    camel_case_note_dict = {note.attribute_map[key]: value for key, value in
                            snake_note_dict.items()}
    return camel_case_note_dict
예제 #4
0
 def testPageOfNotes(self):
     """Test PageOfNotes"""
     # FIXME: construct object with mandatory attributes with example values
     # model = PageOfNotes()  # noqa: E501
     PageOfNotes(
         offset=PageOffset(10),
         limit=PageLimit(10),
         links=ResponsePageMetadataLinks(next="next"),
         total_results=30,
         notes=[Note(identifier=NoteId("identifier"),
                     text="text", type="type",
                     patient_id=PatientId('patient-1'))]
     )
    return camel_case_note_dict


ANNOTATOR_TYPE_MAP = {
    'nlpsandbox:physical-address-annotator':
    ('text_physical_address', 'textPhysicalAddressAnnotations'),
    'nlpsandbox:person-name-annotator':
    ('text_person_name', 'textPersonNameAnnotations'),
    'nlpsandbox:date-annotator': ('text_date', 'textDateAnnotations'),
    'nlpsandbox:contact-annotator': ('text_contact', 'textContactAnnotations'),
    'nlpsandbox:id-annotator': ('text_id', 'textIdAnnotations'),
}

SAMPLE_NOTE = Note(
    type="loinc:LP29684-5",
    identifier=NoteId("snote"),
    patient_id=PatientId("abc123"),
    text="Mary Williamson came back from Seattle yesterday, 12 December 2013.")

SAMPLE_NOTE_ANNOTATIONS = {
    'text_date': [{
        'confidence': 95,
        'dateFormat': 'YYYY',
        'length': 4,
        'start': 62,
        'text': '2013'
    }, {
        'confidence': 95,
        'dateFormat': 'MMMM',
        'length': 8,
        'start': 53,