from bson import ObjectId from rldd import rldd2 from user import rldd_user import pymongo db = rldd2.PROD_connect(rldd_user.login, rldd_user.pwd) claims = db["claims"].find({"activationDate": {'$gte': rldd2.ISODate("2019-12-31T21:00:00.000+0000")}, "service.srguServicePassportId": {'$ne': "5000000010000000897"}, "statuses.statusCode": "7"}) for claim in claims: ccn = claim["customClaimNumber"] claimId = claim["_id"] statuses = db["claims_status"].find({"claimId": str(claimId)}).sort("statusDate", pymongo.ASCENDING) prevStatus = None for index, status in enumerate(statuses): statusCode = status["statusCode"] if prevStatus is None: prevStatus = statusCode if statusCode == "24" and prevStatus == "7": print(ccn) prevStatus = None continue prevStatus = statusCode
"5000000010000101938", "5000000010000103352", "5000000000182799268", "5000000010000006942", "5000000010000000761", "5000000010000006852", "5000000000195377856", "5000000000179648425", "5000000000192723349", "5000000000189809825", "5000000010000014848", "5000000000178524658", "5000000000178525415", "5000000000167012998", "5000000000183523477", "5000000000183523477", "5000000000183523477", "5000000000196395520", "5000000000197114951", "5000000000196930942", "5000000000193989814", "5000000000197085805", "5000000000197085807" ] db = rldd2.PROD_connect(rldd_user.login, rldd_user.pwd) claimsUpdate = db['claims'].update_many( { "service.srguServiceId": { '$in': service_id_map }, "claimCreate": { '$gte': rldd2.ISODate("2019-10-01T00:00:00.000+0000") } }, { '$set': { "service.exterritorialProcessing": True }, '$unset': { 'exterritorialProcessing': "" } }) print( f"Updated CLAIMS: {claimsUpdate.modified_count} / {claimsUpdate.matched_count}" )
"service.srguServicePassportId": { "$ne": "5000000000196394746" } }, { "service.srguServicePassportId": { "$ne": "5000000000167433775" } }, { "service.srguServicePassportId": { "$ne": "5000000000160299214" } }], "provLevel": "ОМСУ", "claimCreate": { "$gte": rldd2.ISODate("2020-01-10T21:00:00.000+0000") } }) for claim in claims: ccn = claim["customClaimNumber"] claimCreate = claim["claimCreate"] serviceName = claim["service"]["name"] passportName = claim["service"]["srguServicePassportName"] departmentName = claim["service"]["srguDepartmentName"] claimId = claim["_id"] isFounded = False try: fields = claim["fields"]["sequenceValue"] for field in fields: if "stringId" in field and field["stringId"] == "municipality": oktmo = field["value"]
from rldd import rldd2 from user import rldd_user db = rldd2.PROD_connect(rldd_user.login, rldd_user.pwd) claims = db["claims"].find({ "activationDate": { '$gte': rldd2.ISODate("2020-09-01T00:00:00.841+0000"), '$lte': rldd2.ISODate("2020-09-11T00:00:00.841+0000") }, "resultStatus": { '$exists': False }, "personsInfo.0.trustedPersons.0.trustedId": { '$exists': True }, "senderCode": "IPGU01001", "trustedPersons": { '$exists': False } }) result_file = open('trustedPersons.log', 'w+') for claim in claims: _id = claim["_id"] try: ccn = claim['customClaimNumber'] personsInfo = claim["personsInfo"] isTrusted = False if "trustedPersons" not in claim or not len(claim['trustedPersons']): for person in personsInfo: if "trustedPersons" in person: del person["trustedPersons"]
from rldd import rldd2 from user import rldd_user db = rldd2.PROD_connect(rldd_user.login, rldd_user.pwd) result_file = open('pushevent.csv', 'w+') claims = db["claims"].find({ "service.srguServiceId": "5000000000216071966", "statuses.1": { '$exists': False }, "claimCreate": { '$gte': rldd2.ISODate("2020-07-04T21:00:00.000+0000") } }) for claim in claims: claimId = claim["_id"] ccn = claim["customClaimNumber"] pushEvent = db["int_push_events"].find({ "event.claimId": str(claimId), "recipient": "EISZVPOO" }) for event in pushEvent: if 'attempts' in event: eventId = event["_id"] upd = db["int_push_events"].update_one( {"_id": eventId}, {"$set": { "status": "NOT_READY", "attempts": 0 }})
import math from rldd import rldd2 from user import rldd_user db = rldd2.PROD_connect(rldd_user.login, rldd_user.pwd) req = { "claimCreate": { '$gte': rldd2.ISODate("2018-12-31T21:00:00.000+0000"), '$lte': rldd2.ISODate("2019-12-31T21:00:00.000+0000") }, "oktmo": { '$ne': "99999999" }, "consultation": False } # Variables rpgu_all = 0 rpgu_result = 0 etc_all = 0 etc_result = 0 current_step = 0 total_count = db["claims"].find(req).count() # Code claims = db["claims"].find(req) for claim in claims: current_step += 1
from rldd import rldd2 from user import rldd_user db = rldd2.PROD_connect(rldd_user.login, rldd_user.pwd) statuses = db['claims_status'].find( {"statusDate": {'$gte': rldd2.ISODate("2018-12-31T21:00:00.000+0000")}, "statusCode": "43", "senderCode": "00000", "senderName": "ЕПГУ", "comment": {'$regex': '.*PIN-код.*'}}) result_file = open('statuses.csv', 'w+') count = 0 result_file.write("customClaimNumber;Collection\n") for status in statuses: count += 1 claimId = rldd2.getId(status['claimId']) claim = db['claims'].find_one({"_id": claimId}) if claim is not None: result_file.write(f"{claim['customClaimNumber']};claims\n") else: claim = db['claims_2018'].find_one({"_id": claimId}) result_file.write(f"{claim['customClaimNumber']};claims_2018\n") print(count) result_file.close()
"day": new_date.day, "hour": new_date.hour, "minute": new_date.minute, "second": new_date.second } for d in r: if r[d] < 10: r[d] = f"0{r[d]}" return f'{r["day"]}-{r["month"]}-{r["year"]} {r["hour"]}:{r["minute"]}:{r["second"]}' iterat = 0 file_num = 1 result_file = open(f"./files/mku_new_{file_num}.csv", "w+") db = rldd2.PROD_connect(rldd_user.login, rldd_user.pwd) claims = db["claims_status_mku"].find({"statusDate": rldd2.ISODate("2020-10-01T21:00:00.000+0000")}) for claim in claims: iterat += 1 claimId = claim["claimId"] print(f"{claimId};{getActualDate(claim['statusDate'])}") result_file.write(f"{claimId};{getActualDate(claim['statusDate'])}\n") if iterat % 150000 == 0: file_num += 1 result_file.close() result_file = open(f"./files/mku_new_{file_num}.csv", "w+") result_file.close()
log = open('add_deadlines_covid.log', 'w+') db = rldd2.PROD_connect(rldd_user.login, rldd_user.pwd) # db = rldd2.LOCAL_connect('local') total = 0 corrected = 0 claims = db["claims"].find({ "$or": [{ "deadlineInWorkDays": False }, { "deadlineStages.deadlineInWorkDays": False }], "resultStatus": { "$exists": False }, "activationDate": { "$gte": rldd2.ISODate("2019-07-31T21:00:00.000+0000") } }) # claims = db["claims"].find({"$or": [{"deadlineInWorkDays": False}, {"deadlineStages.deadlineInWorkDays": False}], # "resultStatus": {"$exists": False}, # "activationDate": {"$gte": rldd2.ISODate("2020-03-10T21:00:00.000+0000"), # "$lte": rldd2.ISODate("2020-03-20T21:00:00.000+0000")}}) for claim in claims: total += 1 ccn = claim["customClaimNumber"] claimId = claim["_id"] full_deadline = 0 isWorkingDays = False total_days_to_deadline = 0 print(ccn) try:
"5000000000179232370", "5000000000179232373", "5000000000191948462", "5000000000179232374", "5000000000179232371" ] }], "deptId": dbName, "userDbId": "5ab8bc835d635a69645b0c07", "depSpectator": False, "deleted": False, "signAllowed": True, "approveAllowed": True, "orgName": "ГУИП", "lastModified": rldd2.ISODate("2019-12-11T12:00:25.407+0000"), "lastModifiedBy": "rldd2", "_class": "operator" } upd = db['operators'].insert_one(new_user) print(f'{upd.inserted_id}, Has been inserted.') except TypeError: print(dbName, 'Have no oktmo')
from rldd import rldd2 from user import rldd_user db = rldd2.PROD_connect(rldd_user.login, rldd_user.pwd) claims = db['claims'].find({ "service.srguServicePassportId": "5000000000189808193", "activationDate": { '$gte': rldd2.ISODate("2020-05-08T21:00:00.000+0000") } }) for claim in claims: _id = claim['_id'] ccn = claim['customClaimNumber'] docs_count = db['docs'].count_documents({'ownerId': str(_id)}) if docs_count == 0: print(f'{ccn}')