MIF (Member Information File) Imports API
Administrative endpoints for importing Member Information Files (MIF) containing ECM patient demographics and eligibility data.
Overview
MIF files are used to import ECM patient data from health plans. The system supports CSV, XML, and XLSX file formats. When imported, the system creates or updates patient records and their associated ECM eligibility information.
Import MIF File
Import a Member Information File to create or update ECM patient records.
Endpoint: POST /v1/admin/clinic/ecm/mifs
Authentication: Required (Admin role)
Request Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
mif | object | Yes | MIF file data object |
mif.file | string | Conditional | Base64-encoded file content with data URI prefix |
mif.url | string | Conditional | URL to fetch the file from |
mif.path | string | Conditional | Server-side file path |
mif.file_type | string | No | File type: csv, xml, or xlsx (auto-detected if not provided) |
Note: You must provide at least one of: file, url, or path.
File Format Requirements
CSV Format
- Must include header row with field names
- Field names are case-insensitive
- Supports comma-separated or tab-separated values
- All dates must be in MM-DD-YYYY format
XML Format
- Must be well-formed XML
- Root element can be
<Members>or any other root tag - Each patient record should be in a
<Member>element - Field names should match the MIF specification (uppercase recommended)
XLSX Format
- Excel 2007+ format
- First row should contain headers
- Data rows follow the header row
Data URI Prefixes
| File Type | Data URI Prefix |
|---|---|
| CSV | data:text/csv;base64, |
| XML | data:text/xml;base64, |
| XLSX | data:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;base64, |
Example Request - Base64 Upload
POST /v1/admin/clinic/ecm/mifs HTTP/1.1
Content-Type: application/json
X-User-Token: your_admin_token_here
{
"mif": {
"file": "data:text/csv;base64,TUVNQkVSX0lELEZJUlNUX05BTUUsTEFTVF9OQU1FLERPQg...",
"file_type": "csv"
}
}Example Request - URL Upload
POST /v1/admin/clinic/ecm/mifs HTTP/1.1
Content-Type: application/json
X-User-Token: your_admin_token_here
{
"mif": {
"url": "https://example.com/mif_file.csv",
"file_type": "csv"
}
}Success Response
{
"message": "MIF data imported successfully",
"imported_count": 15,
"mif_file_id": 1
}Error Response
{
"errors": [
"Invalid CSV format: Unclosed quoted field on line 3",
"Validation failed: Member ID can't be blank"
]
}Import Behavior
The MIF import process follows these rules:
- Patient Matching: Patients are matched by name. If a patient with the same name exists, their record is updated.
- New Patients: If no matching patient is found, a new patient record is created.
- Transaction Safety: All records are processed in a single database transaction. If any record fails validation, the entire import is rolled back.
- Provider Assignment: Patients are automatically assigned to the ECM provider caseload if the provider exists.
- Eligibility Association: All imported eligibility information records are associated with the MIF file for tracking.
MIF Field Mapping
| MIF Field | Database Field | Description |
|---|---|---|
MEMBER_ID | member_id | Unique member identifier (CIN) |
CIN | cin | Client Index Number |
FIRST_NAME | first_name | Patient first name |
LAST_NAME | last_name | Patient last name |
DOB | date_of_birth | Date of birth |
GENDER | gender | Patient gender |
ADDRESS | address | Street address |
CITY | city | City |
STATE | state | State |
ZIP | zip | ZIP code |
PHONE | phone | Phone number |
ECM_SERVICE_AUTH_ID | ecm_service_auth_id | ECM service authorization ID |
ECM_PROVIDER_NAME | ecm_provider_name | ECM provider name |
ECM_NPI | ecm_npi | ECM provider NPI |
ECM_BENEFIT_AUTH_EFF_DATE | ecm_benefit_auth_eff_date | Authorization effective date |
ECM_BENEFIT_AUTH_END_DATE | ecm_benefit_auth_end_date | Authorization end date |
ACUITY_LEVEL | acuity_level | Patient acuity level |
List MIF Files
Retrieve a paginated list of all MIF files that have been uploaded and processed.
Endpoint: GET /v1/admin/clinic/ecm/mifs
Authentication: Required (Admin role)
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
per_page | integer | No | Number of items per page (default: 25) |
page | integer | No | Page number (default: 1) |
Example Request
GET /v1/admin/clinic/ecm/mifs?per_page=10&page=1 HTTP/1.1
Content-Type: application/json
X-User-Token: your_admin_token_hereExample Response
{
"mif_files": [
{
"id": 1,
"filename": "mif_20241124_120530.csv",
"file_type": "csv",
"source_type": "base64",
"records_imported": 15,
"import_errors": null,
"status": "completed",
"created_at": "2024-11-24T12:05:30.000Z",
"updated_at": "2024-11-24T12:05:35.000Z",
"file_url": "https://s3.amazonaws.com/bucket/path/to/file.csv?X-Amz-Algorithm=..."
}
],
"pagination": {
"current_page": 1,
"total_pages": 3,
"total_count": 25,
"per_page": 10
}
}Response Fields
| Field | Type | Description |
|---|---|---|
id | integer | Unique identifier for the MIF file |
filename | string | Generated filename for the uploaded file |
file_type | string | Type of file: csv, xml, or xlsx |
source_type | string | How the file was provided: base64, url, or path |
records_imported | integer | Number of records successfully imported |
import_errors | string | Error messages if import failed (null if successful) |
status | string | Import status: pending, processing, completed, failed |
created_at | string | Timestamp when the file was uploaded |
updated_at | string | Timestamp when the file was last updated |
file_url | string | Presigned S3 URL to download the file (expires in 30 minutes) |
Get MIF File Details
Retrieve details of a specific MIF file including all eligibility information records that were imported from it.
Endpoint: GET /v1/admin/clinic/ecm/mifs/{id}
Authentication: Required (Admin role)
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | integer | Yes | MIF file ID |
Example Request
GET /v1/admin/clinic/ecm/mifs/1 HTTP/1.1
Content-Type: application/json
X-User-Token: your_admin_token_hereExample Response
{
"mif_file": {
"id": 1,
"filename": "mif_20241124_120530.csv",
"file_type": "csv",
"source_type": "base64",
"records_imported": 15,
"import_errors": null,
"status": "completed",
"created_at": "2024-11-24T12:05:30.000Z",
"updated_at": "2024-11-24T12:05:35.000Z",
"file_url": "https://s3.amazonaws.com/bucket/path/to/file.csv?X-Amz-Algorithm=...",
"eligibility_informations": [
{
"id": 123,
"patient_id": 456,
"patient_name": "John Doe",
"member_id": "MEM0000000001",
"cin": "CIN123456",
"first_name": "John",
"last_name": "Doe",
"dob": "1990-01-01",
"ecm_service_auth_id": "AUTH123456",
"ecm_provider_name": "Esteem Health PSC",
"member_record_status": "new_member",
"created_at": "2024-11-24T12:05:32.000Z",
"updated_at": "2024-11-24T12:05:32.000Z"
}
]
}
}JavaScript Example
const fileInput = document.querySelector('input[type="file"]');
const file = fileInput.files[0];
const reader = new FileReader();
reader.onloadend = function() {
const base64String = reader.result;
fetch('/v1/admin/clinic/ecm/mifs', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-User-Token': 'YOUR_TOKEN'
},
body: JSON.stringify({
mif: {
file: base64String,
file_type: 'csv'
}
})
})
.then(response => response.json())
.then(data => console.log(data));
};
reader.readAsDataURL(file);cURL Example
# Encode file to base64
BASE64_FILE=$(base64 -i member_info.csv | tr -d '\n')
# Send request
curl -X POST "https://your-api-domain.com/v1/admin/clinic/ecm/mifs" \
-H "Content-Type: application/json" \
-H "X-User-Token: YOUR_TOKEN" \
-d "{
\"mif\": {
\"file\": \"data:text/csv;base64,${BASE64_FILE}\",
\"file_type\": \"csv\"
}
}"Error Responses
403 Forbidden
{
"errors": ["Admin access required"]
}404 Not Found
{
"errors": ["MIF file not found"]
}422 Unprocessable Entity
{
"errors": [
"Invalid CSV format: Unclosed quoted field on line 3",
"Validation failed: Member ID can't be blank"
]
}Best Practices
- File Size: Keep files under 50MB for optimal performance
- Encoding: Always use base64 encoding for file uploads
- Data URI: Include the appropriate data URI prefix for better type detection
- Error Handling: Always check the
import_errorsfield in file listings for any issues - URL Expiration: Presigned URLs expire after 30 minutes - download files promptly
- Validation: Ensure all required fields are present before uploading
- Date Format: Use MM-DD-YYYY format for all date fields in CSV files